您的位置:首页 > 运维架构 > Linux

ping命令--Linux命令应用大词典729个命令解读

2016-11-07 10:16 435 查看
内容来源于人民邮电出版社《Linux命令应用大词典》

讲述729个命令,1935个例子

学习Linux系统的参考书、案头书,遇到不懂的命令或命令选项一查即可争取每天都发布内容
本文出自 “airfish2000” 博客,更多命令查看博客:http://airfish2000.blog.51cto.com/10829608/1870128

ping命令
使用ping命令可以用来测试与目标计算机之间的连通性。执行ping命令会使用ICMP传输协议发出要求回应的信息,如果远程主机的网络功能没有问题,就会回应该信息,因而得知该主机是否运作正常。命令语法:ping [选项] [目标]命令中各选项的含义如表所示。表 ping命令选项含义
选项
含义
-c <完成次数>
设置完成要求回应的次数
-i <间隔秒数>
在每个数据包发送之间等待的时间(秒数)。缺省值为在每个数据包发送之间等待1秒
-n
指定只输出数字。不去查寻主机地址的符号名
-s <数据包大小>
指定要发送的数据的字节数。默认值是56
-t <存活数值>
设置存活数值TTL的大小
-b
允许执行ping广播地址
-v
显示详细输出信息
-q
安静输出
-r
绕过正常的路由表,直接发送到连接接口上的主机
-W <超时>
等待一个响应的时间,单位为秒
-w <截止日期>
指定超时,单位为秒
-B
不允许ping来改变探测器的源地址
-L
抑制组播数据包的回送。仅适用ping目标是一个多播地址
-I <接口地址>
设置源地址为指定接口的地址
-R
记录路由
例:测试与网站www.sina.com的连通性。[root@rhel~]# ping www.sina.comPINGjupiter.sina.com.cn (202.108.33.60) 56(84) bytes of data.64bytes from 202.108.33.60: icmp_seq=1 ttl=248 time=108 ms64bytes from 202.108.33.60: icmp_seq=2 ttl=248 time=17.7 ms64bytes from 202.108.33.60: icmp_seq=3 ttl=248 time=47.0 ms64bytes from 202.108.33.60: icmp_seq=4 ttl=248 time=22.3 ms64bytes from 202.108.33.60: icmp_seq=5 ttl=248 time=95.3 ms........................(省略)//在Linux系统中用该命令会不间断地返回ICMP数据包,要停止测试按[Ctrl+c]键例:测试与计算机192.168.0.200的连通性,每次发送的ICMP数据包大小为128字节。[root@rhel~]# ping -s 128 192.168.0.200PING192.168.0.200 (192.168.0.200) 128(156) bytes of data.136bytes from 192.168.0.200: icmp_seq=1 ttl=64 time=0.446 ms136bytes from 192.168.0.200: icmp_seq=2 ttl=64 time=0.278 ms136bytes from 192.168.0.200: icmp_seq=3 ttl=64 time=0.287 ms136bytes from 192.168.0.200: icmp_seq=4 ttl=64 time=0.279 ms136bytes from 192.168.0.200: icmp_seq=5 ttl=64 time=0.286 ms136bytes from 192.168.0.200: icmp_seq=6 ttl=64 time=0.320 ms136bytes from 192.168.0.200: icmp_seq=7 ttl=64 time=0.281 ms........................(省略)例:测试与计算机192.168.0.200的连通性,发送4个ICMP数据包。[root@rhel ~]# ping -c 4 192.168.0.200PING 192.168.0.200 (192.168.0.200) 56(84) bytes of data.64 bytes from 192.168.0.200: icmp_seq=1 ttl=64 time=0.357ms64 bytes from 192.168.0.200: icmp_seq=2 ttl=64 time=0.287ms64 bytes from 192.168.0.200: icmp_seq=3 ttl=64 time=0.290ms64 bytes from 192.168.0.200: icmp_seq=4 ttl=64 time=0.290ms --- 192.168.0.200 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time3038msrtt min/avg/max/mdev = 0.287/0.306/0.357/0.029 ms
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  命令 Linux RHEL