linux中如何设置iptables防火墙确保外部ping通

2025-10-21 06:53:38

1、外部使用ping命令提示请求超时

linux中如何设置iptables防火墙确保外部ping通

2、在linux系统中使用iptables -L命令查看防火墙设置,默认input策略为DROP,没有其他放行策略

linux中如何设置iptables防火墙确保外部ping通

1、使用命令:iptables -I INPUT -p icmp -j ACCEPT 放行ping对应的ICMP流量

linux中如何设置iptables防火墙确保外部ping通

2、使用iptables -L查看放行后策略

linux中如何设置iptables防火墙确保外部ping通

3、自外部局域网电脑使用ping命令检测,可以看到可以ping通了。

linux中如何设置iptables防火墙确保外部ping通

1、防火墙设置完成后一定要使用命令:service iptables save保存设置,否则重启会丢失

如果执行失败报出:The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.说明iptables服务没有安装或者更新

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢