序言
在访问网络是否ok, 通常喜欢用ping 命令来访问ping www.baidu.com
看是否出现超时;ping在不同的操作系统平台实现方式差不多,底层都是用ICMP协议,每次发ICMP ECHO_REQUEST packet (IP地址/Host, ttl,icmp_seq序列号,RTD/RTT(往返延时)记录 ), 运行结束后统计每个RTT, 最大RTT, 最小RTT, 平均RTT, 标准偏差RTT, 发送/接受packets总数,丢包率 等数据,ping工具在PING(8)中的定义如下:
The ping utility uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST datagrams (“pings'') have an IP and ICMP header, followed by a “struct timeval'' and then an arbitrary number of “pad” bytes used to fill out the packet.