什么是 Ping?
Ping 一个域名的时候没有返回,但是 Ping 一个 IP 的时候,返回是正确的,这说明是这个域名的 DNS 出了问题,Ping 本身走的协议(ICMP协议)就是一个专门用来处理 IP 问题的协议,Ping 走的 ICMP 协议介绍(很详细的一个介绍):
ICMP 的 RFC:
除了 Ping 以外,ICMP 还可以做很多的事情,这里可以看到:
然后我们经常听到的「禁Ping」,其实也就是禁止掉 ICMP 协议:
How to check if ICMP blocking is enabled in a system
To check whether ICMP is enabled or disabled run the command:
cat /proc/sys/net/ipv4/icmp_echo_ignore_all
The output is 0 or 1:
- 0 means that ICMP is enabled
- 1 means that ICMP is disabled
If it’s disabled and you want to enable it:
- change 1 to 0 in the above file
- Or run the command:
iptables -I INPUT -i ech0 -p icmp -s 0/0 -d 0/0 -j ACCEPT