软件
Ubuntu 服务器:
ubuntu@server: $ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.10
DISTRIB_CODENAME=wily
DISTRIB_DESCRIPTION="Ubuntu 15.10"
NAME="Ubuntu"
VERSION="15.10 (Wily Werewolf)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 15.10"
VERSION_ID="15.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
ubuntu@server: $ ping -V
ping utility, iputils-s20121221
Raspberry Pi 1 型号 B:
pi@raspberrypi: $ cat /etc/*-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi: $ ping -V
ping utility, iputils-s20121221
预期结果
ubuntu@server: $ ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=17.3 ms
Request timeout for icmp_seq 2
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=17.0 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=55 time=14.1 ms
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3001ms
rtt min/avg/max/mdev = 14.172/15.922/17.340/1.312 ms
重要的部分是丢失的包,这正如我所期望的那样,如果包丢失或者需要很长时间,ping 命令应该打印一条Request timeout
消息......但在 Raspberry Pi 上......
真正的结果
pi@raspberrypi: $ ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=12.8 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 time=12.4 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=58 time=12.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=58 time=13.2 ms
--- 8.8.8.8 ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 3002ms
rtt min/avg/max/mdev = 12.289/12.724/13.284/0.397 ms
如果你看得不够仔细,你可能会错过错误所在。但它5 packets transmitted
并没有打印Request timeout
,甚至没有转到下一个icmp_seq
,它只是重新发送了丢失的包,没有任何错误,你只有在阅读最后的摘要时才会发现数据包是否丢失。
问题
为什么同一个ping
版本在不同的系统上表现不同?
ping 命令是否有一个我可以编辑的配置,以使其表现相同?