linux禁止ping的实现实例

2019-01-16 23:56:21刘景俊

linux禁止ping的实现实例

1、临时禁止PING操作的命令为:#echo 1>/proc/sys/net/ipv4/icmp_echo_ignore_all

2、永久禁止PING配置方法

/etc/sysctl.conf 中增加一行 net.ipv4.icmp_echo_ignore_all=1 执行sysctl -p生效

防火墙方式:

     1、允许PING设置     

iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT

       或者也可以临时停止防火墙操作的。

service iptables stop

     2、禁止PING设置

iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

您可能感兴趣的文章:

Linux下指定源ip进行ping操作的方法Linux编程之PING实现在Windows与Linux下禁止被ping的设置方法[推荐]Linux 管理员手册(9)--Keeping Timelinux解决ping通但端口不通的问题