禁止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