kindquiet素食勤俭敬老孝慈

centos Linux 禁止和开启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