如何正确使用Windows的Ping命令
0
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 m 5_ :?P>))vT% 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: %nV6#pr 5XzN%<_h9 ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [[-j computer-list] | [-k computer-list]] [-w timeout] destination-list Wi+}qO w\zNn4B})A Options: gski:C
x+8%4]u` -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. {%+UQ!]d8 W QqOXF 不停的ping地方主机,直到你按下Control-C。 WYm
<_1 V.-cm51I 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 }Y!v"DO#Q* I|<`Er-;58 -a Resolve addresses to hostnames. Vj[hT~{f 7DPxz'7): 解析计算机NetBios名。 JLak>MS )W/_2Q. 示例:C:\>ping -a 192.168.1.21 <8ih >s(C
:(YFIW`59 Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: _`lPLBr6 R0urt Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
#wZbG|% 7l4}b^>/` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 Md&K#)9,( p2
!w86 F Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 NNMn,J WidLUv Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 CIVV"p`} 5cb8=W- Ping statistics for 192.168.1.21: d .Q<!Au3 Q$Rp?o& Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Lb?0< `O!yt Minimum = 0ms, Maximum = 0ms, Average = 0ms PbfgWGr \}AJ)v*< 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ANfy
+@ &x$
ps -n count Number of echo requests to send. q.j$]?PQ j=c< Lo` 发送count指定的Echo数据包数。 iba8G]2 CF
v ]wS 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: GiKhdy DQ&\k'"\ C:\>ping -n 50 202.103.96.68 ZZ/k7(8 s<oT,SPt Pinging 202.103.96.68 with 32 bytes of data: ~S$ex,~ 5H, (\Xd Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ,c
0]r;u! %cJdVDW`L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 )|#ExyRO 0#ON}l)> Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 lTVz'ys [z6P]eC7 Request timed out. 0DN&HMI# jo<Gf 5 ……………… a&dP@) @}uo:b:Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 c(Fo-4K %eGD1.R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 Z-M4J;J@} nA%8
bZ+ Ping statistics for 202.103.96.68: t}MT<Jj }.=@^-JBA5 Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: (C%qA<6 Ct:c%D(L Minimum = 40ms, Maximum = 51ms, Average = 46ms |HPb$#i K
qNsCT+j 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 1KJ[&jS ] u!b0<E -l size Send buffer size. J`wx72/-ZW -cUw} 定义echo数据包大小。 =S\
pI 'o7V6KG 在默认的情况下windows的ping发送的数据包大小为 32byt,我们也可以自己定义它的大小,但有一个大小的限制,就是最大只能发送65500byt,也许有人会问为什么要限制到65500byt,因为 Windows系列的系统都有一个安全漏洞(也许还包括其他系统)就是当向对方一次发送的数据包大于或等于65532时,对方就很有可能挡机,所以微软公司为了解决这一安全漏洞于是限制了ping的数据包大小。虽然微软公司已经做了此限制,但这个参数配合其他参数以后危害依然非常强大,比如我们就可以通过配合-t参数来实现一个带有攻击性的命令:(以下介绍带有危险性,仅用于试验,请勿轻易施于别人机器上,否则后果自负) wB< |