ping 0

On Linux:

1
2
3
4
$ ping 0
PING 0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.075 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.065 ms

On Mac:

1
2
3
4
$ ping 0
PING 0 (0.0.0.0): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host

在这里,它翻译为一个空路由0.0.0.0

0 是可选的

1
2
3
4
$ ping 127.1
PING 127.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.065 ms

需要注意的是,0在中间是可选的,若在最后,不能省略。

1
2
3
4
$ ping 192.168.141
PING 192.168.141 (192.168.0.141) 56(84) bytes of data.
64 bytes from 192.168.0.141: icmp_seq=1 ttl=63 time=0.470 ms
64 bytes from 192.168.0.141: icmp_seq=2 ttl=63 time=0.431 ms

ip 地址溢出

例如:

1
2
3
4
5
# 最后一个数字可解释为2x256 + 1
$ ping 192.168.513
PING 192.168.513 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=254 time=0.137 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=254 time=0.113 ms

十进制 ip 表示法

例如:

1
2
3
4
$ ping 167772673
PING 167772673 (10.0.2.1): 56 data bytes
64 bytes from 10.0.2.1: icmp_seq=0 ttl=61 time=15.441 ms
64 bytes from 10.0.2.1: icmp_seq=1 ttl=61 time=4.627 ms