萬盛學電腦網

 萬盛學電腦網 >> 服務器教程 >> centos禁止與開啟ping設置

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

copyright © 萬盛學電腦網 all rights reserved