  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ; s) f2 f6 N, N; i
% m) H8 S6 S8 x: T& p7 M6 g# N
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: + i" H9 I6 b& ?) U
2 P$ f6 h2 [% y2 _ 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 5 c5 o& M0 r! c$ b
, D$ C/ `. r* V9 P. r8 s8 e Options: , j6 d* }) L; b$ [* I# ^
R" m. Q; B" t0 c3 u -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / ?, a O0 w3 Z& P8 J8 W) l* J$ _, B# W
1 }0 x- R/ a9 D 不停的ping地方主机,直到你按下Control-C。
6 P# c3 i+ L4 t" ?% O : [' l" m1 h2 a/ Q
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & d5 q! D. m) J
; Q* ?3 t1 [1 i- i9 G0 Z& Y+ b/ U, y- j -a Resolve addresses to hostnames.
5 V9 Y& O( a1 y& f# e5 a% B. h - ^+ }: J+ s# _+ Y8 ^4 D3 F* w
解析计算机NetBios名。
) p5 O5 i0 r$ j: u9 p6 t
( K+ E# h8 X) y1 `. e 示例:C:\>ping -a 192.168.1.21 0 \. h+ Y# h7 f4 \' b
2 @# V# O) r9 e% U$ p9 Y0 f
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % j, _) i$ G2 t- g6 S# _
6 [* f9 n# Q6 {& j4 D! Z, ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. r7 a, [, N# @
/ X" J. {+ L* x! P& |1 i% I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: Q8 {4 U5 P. C' f0 i: c. o4 I 5 p( w' w; U" P% u, u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 I! e2 w! w, W, j5 r6 b
" s' h% n2 w# j! Q' D
" p4 \) Z/ }2 k; a$ ]5 _5 H Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' s% r% Q: y8 W4 J) _, p
3 P8 C, `' P* _ Ping statistics for 192.168.1.21: 0 d- a/ `! f# X, p
- ~9 Y& i$ x; Q( B c' W: c" e Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # f8 S7 ]& Q- w! d
& }/ f2 h, S& b9 B Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ Z& D% Z) ^( \' M* H% M K
+ V- t' w |- b7 A 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
9 A' | _) d$ h& P: O( G2 O- d
+ z9 A* L5 \: z -n count Number of echo requests to send.
( S5 {: [; I# L( d) H# Y7 v ; Q$ |; u! l0 ~* J
发送count指定的Echo数据包数。
9 ^: [- Y0 b& o8 f 5 u& s- H- J% s }' T' w
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 1 R/ _; ?$ h$ W4 @# H8 W2 d( P. ^
: Z3 v- `2 v( W$ }; O C:\>ping -n 50 202.103.96.68 9 c9 z) `. K: q" I- c: O3 b6 k7 }
( @! |. P8 u! n( v" ]
Pinging 202.103.96.68 with 32 bytes of data: 8 Q P& }9 X& _1 d/ x4 J
" p" [0 z. h+ u; g+ z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , _! ?, d0 ^* f/ G x7 U
5 R9 T1 e5 J) M3 @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + f4 U2 I' L2 M2 R# N
. g+ R. }3 i& F/ b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 s/ x" Q6 N% V& O4 F / B/ ^7 Z7 U0 g, z' y. \
Request timed out.
) M0 s( s9 B& Q2 J9 C2 B7 a / [' o9 N, B( |7 j9 {" L/ g
………………
7 n% n; F; g5 ^2 @ 0 J% M0 \8 v+ v/ T' T) N4 N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 m" ^0 X9 g' O# P U5 A6 v 1 d7 b" b3 M; D# N* \3 @" Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, n1 _/ Y! Y/ X
, W8 G T s9 R5 {5 m0 w0 H# \6 w9 | Ping statistics for 202.103.96.68:
1 D! `3 \; v# V) n/ V 5 c( x! y; s( i* e9 Q( `7 |
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ) e, X V5 F) L$ W1 S
0 K% h9 g/ v- f, k( e, L% _
Minimum = 40ms, Maximum = 51ms, Average = 46ms
& a- R. _& _+ X% O; s ^
% @6 i$ ?. C' L& k1 P 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
7 J5 m$ a/ U+ v" c/ q7 {
) B4 O( m- \! _ -l size Send buffer size.
6 V9 b. A2 m% i6 b+ h & s( ^. U/ w; f6 d3 S
定义echo数据包大小。 |
|