功能说明:检测主机。 linuxso注:linux下的ping和windows下的ping稍有区别,linux下ping不会自动终止,需要按ctrl+c终止或者用参数-c指定要求完成的回应次数 linux下测试本机与目标主机连通性的命令是ping,这里主要讲解两个参数 –c 与 – i 其中 –c count 次数,也就是ping的次数 -i interval 间隔 ,每次ping之间的时间空格
[Blinux@Blinux gftp-2.0.19]$ ping -c 10 -i 0.5 www.g.cn
PING www.g.cn (203.208.39.99) 56(84) bytes of data.
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=1 ttl=128 time=43.3 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=2 ttl=128 time=43.6 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=3 ttl=128 time=42.8 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=4 ttl=128 time=42.4 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=5 ttl=128 time=42.9 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=6 ttl=128 time=42.2 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=7 ttl=128 time=42.8 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=8 ttl=128 time=41.8 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=9 ttl=128 time=42.2 ms
64 bytes from bi-in-f99.google.com (203.208.39.99): icmp_seq=10 ttl=128 time=42.4 ms
--- www.g.cn ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 4498ms
rtt min/avg/max/mdev = 41.820/42.678/43.627/0.543 ms
当然如果上面 –i 的时间小于ping的time,系统将会提示 [Blinux@Blinux gftp-2.0.19]$ ping -c 10 -i 0.01 www.g.cn PING www.g.cn (203.208.39.160) 56(84) bytes of data. ping: cannot flood; minimal interval, allowed for user, is 200ms(责任编辑:IT) |