centos禁止与开启ping设置
禁止ping:
代码如下 | |
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all |
允许ping:
代码如下 | |
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all |
防火墙/etc/sysconfig/iptables添加
-A INPUT -p icmp -m icmp --icmp-type echo-request -m state --state NEW -j ACCEPT
/etc/init.d/iptables restart
iptables -L -nv
7 588 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW icmp type 8
赞 (0)