ping 主要用于检查网络
1. ping www.baidu.com
ping www.baidu.com PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data. 64 bytes from 220.181.112.244: icmp_seq=1 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=2 ttl=52 time=20.9 ms 64 bytes from 220.181.112.244: icmp_seq=3 ttl=52 time=20.9 ms 64 bytes from 220.181.112.244: icmp_seq=4 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=5 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=6 ttl=52 time=20.9 ms 64 bytes from 220.181.112.244: icmp_seq=7 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=8 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=9 ttl=52 time=21.0 ms 64 bytes from 220.181.112.244: icmp_seq=10 ttl=52 time=20.9 ms 64 bytes from 220.181.112.244: icmp_seq=11 ttl=52 time=20.9 ms ^C --- www.a.shifen.com ping statistics --- 11 packets transmitted, 11 received, 0% packet loss, time 10014ms rtt min/avg/max/mdev = 20.904/20.997/21.049/0.128 ms
medv(Mean Deviation,表示ICMP包的RTT偏离平均值的成都)的值用于衡量网速的稳定性,越小越好
2. 常见的参数:
-c :指定ping的次数,例如:ping 百度 4次, ping -c 3 www.baidu.com
-q:直接查看结果
-s:指定ping的数据包大小, 例如:ping 百度1个字节, ping -s 1024 www.baidu.com
-t:指定TTL(数据包在被丢弃之前在路由器之间的转换次数)的数
-i:指定ping的时间间隔