码迷,mamicode.com
首页 > 其他好文 > 详细

ping命令总结

时间:2016-11-18 19:41:01      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:ping命令

1.1 功能说明

发送ICMP包到网络主机

1.2 语法格式

ping [参数] [主机名或IP地址]

参数

说明

简解

-v

Verbose output.

详细输出

-i

interval

间隔的秒数

-c

count

数目,在发送指定数目的包后停止

-t

Set the IP Time to Live.

存活数值:设置存活数值TTL的大小

-s

packetsize

字节数:指定发送的数据字节数

1.3 实践操作

实例1-1  ping指定次数5

命令:ping –c 5 192.168.137.1

代码

[root@ben-test ~]# ping -c 5 192.168.137.1

PING 192.168.137.1 (192.168.137.1) 56(84) bytes ofdata.

64 bytes from 192.168.137.1: icmp_seq=1 ttl=64time=2.01 ms

64 bytes from 192.168.137.1: icmp_seq=2 ttl=64time=1.07 ms

64 bytes from 192.168.137.1: icmp_seq=3 ttl=64time=0.485 ms

64 bytes from 192.168.137.1: icmp_seq=4 ttl=64time=0.397 ms

64 bytes from 192.168.137.1: icmp_seq=5 ttl=64time=0.760 ms

 

--- 192.168.137.1 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss,time 4006ms

rtt min/avg/max/mdev = 0.397/0.944/2.012/0.584 ms

 

实例1-2  时间间隔0.5秒和次数5

命令:ping –i 0.5–c 5 192.168.137.1

代码

[root@ben-test ~]# ping -i 0.5 -c 5 192.168.137.1

PING 192.168.137.1 (192.168.137.1) 56(84) bytes ofdata.

64 bytes from 192.168.137.1: icmp_seq=1 ttl=64time=0.364 ms

64 bytes from 192.168.137.1: icmp_seq=2 ttl=64time=0.588 ms

64 bytes from 192.168.137.1: icmp_seq=3 ttl=64time=0.496 ms

64 bytes from 192.168.137.1: icmp_seq=4 ttl=64time=0.486 ms

64 bytes from 192.168.137.1: icmp_seq=5 ttl=64time=0.490 ms

 

--- 192.168.137.1 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss,time 2003ms

rtt min/avg/max/mdev = 0.364/0.484/0.588/0.076 ms

 

实例1-3   时间间隔0.5秒和次数5,包大小为1024

命令:ping –i 0.5–c 5 –s 1024 192.168.137.1

代码

[root@ben-test ~]# ping -i 0.5 -c 5 -s 1024192.168.137.1

PING 192.168.137.1 (192.168.137.1) 1024(1052) bytesof data.

1032 bytes from 192.168.137.1: icmp_seq=1 ttl=64time=0.561 ms

1032 bytes from 192.168.137.1: icmp_seq=2 ttl=64time=0.759 ms

1032 bytes from 192.168.137.1: icmp_seq=3 ttl=64time=0.447 ms

1032 bytes from 192.168.137.1: icmp_seq=4 ttl=64time=0.375 ms

1032 bytes from 192.168.137.1: icmp_seq=5 ttl=64time=0.525 ms

 

--- 192.168.137.1 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss,time 2003ms

rtt min/avg/max/mdev = 0.375/0.533/0.759/0.131 ms


本文出自 “斌少的技术博客” 博客,请务必保留此出处http://yinjianbin.blog.51cto.com/4529118/1874122

ping命令总结

标签:ping命令

原文地址:http://yinjianbin.blog.51cto.com/4529118/1874122

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!