禁止被ping
[root@GitLab ~]# echo >/proc/sys/net/ipv4/icmp_echo_ignore_all
无法被ping
[root@NB ipv4]# ping 10.100.2.84
PING 10.100.2.84 (10.100.2.84) () bytes of data.
允许被ping
[root@GitLab ~]# echo >/proc/sys/net/ipv4/icmp_echo_ignore_all
可以ping 通服务器
[root@NB ipv4]# ping 10.100.2.84
PING 10.100.2.84 (10.100.2.84) () bytes of data.
bytes from 10.100.2.84: icmp_seq= ttl= time=0.304 ms
bytes from 10.100.2.84: icmp_seq= ttl= time=0.373 ms
以上是临时生效,永久生效是:
在/etc/sysctl.conf文件中添加
net.ipv4.icmp_echo_ignore_all =
然后执行 sysctl -p
这种方法是永久生效!!!