计算机网络/计算机科学与应用/系统/运维/开发

Linux【ping】测试与网站之间的连通性

  ping命令

  测试与目标主机之间的连通性,如果远程主机网络功能没有问题,就会返回信息


  语法:

  ping [选项] [目标]


  选项:

-d:使用 Socket 的 SO_DEBUG 功能;
-c<完成次数>:设置完成要求回应的次数;
-f:极限检测;
-i<间隔秒数>:指定收发信息的间隔时间;
-I<网络界面>:使用指定的网络界面送出数据包;
-l<前置载入>:设置在送出要求信息之前,先行发出的数据包;
-n:只输出数值;
-p<范本样式>:设置填满数据包的范本样式;
-q:不显示指令执行过程,开头和结尾的相关信息除外;
-r:忽略普通的 Routing Table,直接将数据包送到远端主机上;
-R:记录路由过程;
-s<数据包大小>:设置数据包的大小;
-t<存活数值>:设置存活数值TTL的大小;
-v:详细显示指令的执行过程。


实例:测试网站之间的连通性

[root@Linux ~]# ping www.gyzth.top
PING www.gyzth.top (121.41.221.55) 56(84) bytes of data.
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=1 ttl=58 time=26.3 ms
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=2 ttl=58 time=26.3 ms
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=3 ttl=58 time=26.3 ms
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=4 ttl=58 time=26.3 ms
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=5 ttl=58 time=26.3 ms
64 bytes from 121.41.221.55 (121.41.221.55): icmp_seq=6 ttl=58 time=26.3 ms


实例:指定次数

** 指定次数
[root@c7 ~]# ping -c 5  192.168.181.131
PING 192.168.181.131 (192.168.181.131) 56(84) bytes of data.
64 bytes from 192.168.181.131: icmp_seq=1 ttl=64 time=0.048 ms
64 bytes from 192.168.181.131: icmp_seq=2 ttl=64 time=0.083 ms
64 bytes from 192.168.181.131: icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from 192.168.181.131: icmp_seq=4 ttl=64 time=0.090 ms
64 bytes from 192.168.181.131: icmp_seq=5 ttl=64 time=0.081 ms
--- 192.168.181.131 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4029ms
rtt min/avg/max/mdev = 0.048/0.070/0.090/0.018 ms

人生建议:不要因为嘴硬而失去重要的东西,清醒,知趣,明得失,知进退。

评论

^