昨日举荐: 每天学一个 Linux 命令(61):wget
命令简介
ping 命令用于测试主机之间网络的连通性。
ping 是一种向网络上的另一台计算机发送网络数据并从其接管网络数据的简略办法。它通常用于测试与另一个零碎是否能够通过网络拜访,如果能够,则须要破费多少工夫来替换该数据。
语法格局
ping [options] destination
ping -6 [options] destination
选项阐明
-c< 实现次数 > #指定要求回应的次数
-f #最大极限检测
-i< 距离秒数 > #指定收发信息的间隔时间
-n #只输入数值
-p< 范本款式 > #设置填满数据包的范本款式
-q #不输入执行过程信息,结尾和结尾的相干信息除外
-r #疏忽一般的 Routing Table,间接将数据包送到远端主机上
-R #记录路由过程
-s< 数据包大小 > #设置数据包的大小
-t< 存活数值 > #设置存活数值 TTL 的大小
-v #具体输入执行过程信息
利用举例
常见举例
[root@centos7 ~]# ping www.baidu.com
PING www.a.shifen.com (36.152.44.95) 56(84) bytes of data.
64 bytes from 36.152.44.95 (36.152.44.95): icmp_seq=1 ttl=56 time=10.5 ms
64 bytes from 36.152.44.95 (36.152.44.95): icmp_seq=2 ttl=56 time=11.8 ms
64 bytes from 36.152.44.95 (36.152.44.95): icmp_seq=3 ttl=56 time=10.7 ms
^C
--- www.a.shifen.com ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6095ms
rtt min/avg/max/mdev = 10.588/11.512/12.007/0.546 ms
[root@centos7 ~]# ping -n www.baidu.com
PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data.
64 bytes from 36.152.44.96: icmp_seq=1 ttl=56 time=13.6 ms
64 bytes from 36.152.44.96: icmp_seq=2 ttl=56 time=14.0 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5032ms
rtt min/avg/max/mdev = 13.616/14.373/14.933/0.442 ms
只进行 2 次 Ping 操作
[root@centos7 ~]# ping -c 2 www.baidu.com
PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data.
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=1 ttl=56 time=14.0 ms
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=2 ttl=56 time=14.4 ms
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1013ms
rtt min/avg/max/mdev = 14.086/14.257/14.428/0.171 ms
极限 PING 测试
[root@centos7 ~]# ping -c 10 -f www.baidu.com
PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data.
--- www.a.shifen.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 110ms
rtt min/avg/max/mdev = 13.368/13.587/13.871/0.142 ms, pipe 2, ipg/ewma 12.279/13.609 ms
每天学一个 Linux 命令(58):telnet
每天学一个 Linux 命令(59):ssh
每天学一个 Linux 命令(60):scp