|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 & D2 k5 O& n ~
4 z% P" ~' O- y7 i8 ^2 t8 F 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
J3 _9 W5 W& [% j' u) j; p ; I# h6 A! m' Q
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
" @) Q% H4 B+ B0 M& k, |# I# M
! h- o1 T! a1 u Options: ) F% D: E3 F( l) \2 p" ?
/ F- } V% O4 z; x' r5 z5 t" a: V, a -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. & E/ g! I w/ z# T6 w
; @/ c0 v/ I- T
不停的ping地方主机,直到你按下Control-C。
7 s; k$ b: i7 p" [: ~& V
8 R% H4 H. q( e, O d- C. R0 a 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 J/ S1 B7 j$ o d- e' B " c# M$ C' c% ^
-a Resolve addresses to hostnames. / X* f% \1 @5 r! e- Q0 E9 J; \
+ x% A! C0 C. K2 {
解析计算机NetBios名。 - N/ y' ~7 o$ m2 s& F- l( ?' {0 K( b) M
# o2 r M$ y+ M9 f" n3 I3 ^* v
示例:C:\>ping -a 192.168.1.21
$ v2 W1 o+ T! G
6 P# {- o9 ], q: R Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
1 Q( i- f1 D( h) U7 X
r* p% K/ A. H* I- g1 ]4 I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( T; n" c. y2 u0 M X" K7 R. [6 W% { * r5 g* K2 s! W; @% W/ k( {3 x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * g/ p1 ` w/ L+ W: s& _
6 B/ e1 y2 m! p( H9 L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 d- i ^" i- F* d$ j; a8 \, a' ?' x+ v5 l
1 X3 d9 z$ h B; f9 e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* ~2 X; G) Q7 V6 M3 m3 N9 ^
& H9 d( `* f8 q) F8 E& Z Ping statistics for 192.168.1.21:
6 T0 Q9 u; Y; n9 N; f5 ^# ^5 d % s: p: ]3 s/ z4 R2 h
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; q9 @7 w6 d* ~4 G2 o5 V* }6 U4 t! A . O; I% Q+ M( e7 d. P
Minimum = 0ms, Maximum = 0ms, Average = 0ms
! u i" p5 t+ t- q
/ x! ^' g" Y! H# ? 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& P' d' H5 X9 y% G# w
& `, K2 i2 T- Y" E1 h4 a+ h -n count Number of echo requests to send. 0 e5 C! g, q. o
1 k" j4 o& V6 e4 G/ j8 Y6 d3 q ` 发送count指定的Echo数据包数。 7 U3 w6 V" H4 j' B% Q Q
! G% y) P! J, t J9 _/ F* q, }
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: * J) V# o+ S/ e2 P& G
$ s: c' H1 a4 O6 ^8 O2 r+ t- z
C:\>ping -n 50 202.103.96.68
2 w9 P7 x- j: R3 ~ g
5 w m0 j+ Z, ? Pinging 202.103.96.68 with 32 bytes of data:
8 n: U" O/ ? n% g4 W4 x
( {1 N: y" N6 G$ C# Y/ {! l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
h3 }! O* Q `
4 h9 }+ ?' m' \; z$ j8 V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. d) s: G) r1 _1 j" A# s) Q
9 g8 H- `' \4 I& [5 O& P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * X- ?6 `2 F0 D6 f {" u$ p* b
b, M( H1 d! c7 `; L Request timed out. 9 w4 c" d) O! L: t1 ?0 r
2 z. Y S! [: ~* P3 s ……………… + @% _" \) p. U! u
" I1 j6 P4 j9 ?2 y L& ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; z, \- `; M- c t7 j6 ` X
% a7 n0 D7 Z3 j, V! d6 D; _8 M4 r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : t# Y8 h& ]/ }( q |8 n
7 s w6 _: {1 _6 O% Z Ping statistics for 202.103.96.68: # u! g. H) r. E- k& _* z2 N
! r2 k/ W# t9 W) h Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
* Z* [7 P) F: l7 P7 I " w+ e/ k% k( t. E! r2 N
Minimum = 40ms, Maximum = 51ms, Average = 46ms % L* N1 k' z' B) B B/ d
N& @7 ~. w+ ~# r3 T& `, M
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
- E1 a2 t* K! }# S& y
7 A5 z( K I: g* e -l size Send buffer size.
$ c g: _. h9 }- b+ s2 q. N( j( t+ K; A # O% }6 M* S, }- X Y/ h* f
定义echo数据包大小。 |
|