Board logo

标题: 教你正确使用Windows的Ping命令 [打印本页]

作者: 野人e族    时间: 2008-1-27 22:16     标题: 教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
5 }2 [% ~( }; e2 L( d3 w  
/ v8 P( o) K% h1 N" ?2 v+ g5 S; {/ a  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 ^! ~( s3 v6 Z  y
  
; [7 I+ b+ a- g. ?& m0 d  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
! L& j- l2 F) z8 ?- w9 ?) r# |& L  
7 E* R+ A- V4 t; N5 X, K  Options:
4 H+ I$ ^2 E+ Y. f   , P$ e# W. A$ B6 K- M- B
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. " }" [7 A# q" B" f
  
: \; P% A4 G6 y! r3 g  不停的ping地方主机,直到你按下Control-C。 3 u7 ^( ]. T7 f
     M6 v7 \3 i2 O% a5 G: D4 X
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. i7 |2 ~$ e$ `: x5 F! E   ) }0 O& D+ f. q7 w0 B/ p
  -a Resolve addresses to hostnames.
0 Z% t6 A- e3 @& j; o" s  
" g$ v- g% ~# {# o  解析计算机NetBios名。 ) h5 C7 e9 U1 a6 h# h: q. |8 E: X; m
  
  @! c& Q& p" }- f7 ^# ~1 _  示例:C:\>ping -a 192.168.1.21 1 K, @/ o* T! r% u4 w3 S
  
: h+ N4 F7 @9 I5 A  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # ^. J2 D* D$ z9 \* j* Z/ H
  
- v+ S/ c0 k2 Q0 L  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % d3 N4 x1 u! N$ B
  
( i: a# p2 w! [+ f7 F2 G, i4 L- H  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ R0 ?2 X% g5 }( F4 k% Z" C# ]   0 `' d1 T) |. l0 c  [
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # v( F8 u( Y+ H2 R7 T- b  W- t

% {2 d! t5 r; Z3 ?4 F   ( [7 A4 i* f" V7 V, N, ?7 b2 l
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* \, t# S. e4 ~" e) `7 {' L# W+ b  
. ^2 N! r  b! F' z5 W  Ping statistics for 192.168.1.21: " @* z7 Q. k4 S5 ^4 l
  
# j: E' t3 I: ]; T2 F5 |' ~4 |  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , @, f- \: V2 i( _2 {8 Q
  
/ J* {. h, i2 j9 ]; E# e  Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ p/ ~; W* w8 J   " a8 X: E; }$ G4 l$ C$ l# I8 T
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
) {3 a0 \7 _: T  D' }# J# |. M   ; x1 t  e2 i; f, Q! T! k! i) b
  -n count Number of echo requests to send.   i7 y' d- U' ~
   ; n! O' T6 G% j* H5 V3 d# s
  发送count指定的Echo数据包数。
, {& Q& ]$ p6 m4 ?: v, K  
' z! x' z( ]  o4 W1 {5 \  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 4 @: [3 s5 p( M1 J7 Q# Z2 h5 `) z9 Y! a
  
, Z! S6 z' n$ k' M3 R  C:\>ping -n 50 202.103.96.68
9 s' B9 o) |% {* @5 m. P   ) s: g; @; {- }
  Pinging 202.103.96.68 with 32 bytes of data:
* B0 a- e$ ], |$ C+ I   / A4 E5 {$ g* T4 r5 ^
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * D" }  h; ?! {3 L& d
  
  g0 [/ w. W7 X% J1 [; X# N  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! D( t, N" Q* Y8 u' F) P: q. Y1 {* f
  
: A% `% b6 U; s( C  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& |) e3 p  U+ E; [  [! i# T   & S3 c+ j2 [  S3 n( T" `
  Request timed out. ' g, T# a; ~, g3 A* r* h! O5 Y
   7 [  p+ [: \/ P9 L6 s
  ……………… & V6 d# e% m( d1 D* b1 b# p
   & b. a1 O! F* n) @% d
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 R8 c, j: p( K* I
   ' z3 j' Z5 y) ^2 e# Y: u1 k
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: T1 |. ~7 M/ N+ C5 z/ K  
# U7 i% \% Z% @' r  Ping statistics for 202.103.96.68: 4 O( B% k6 |3 U- C3 D7 i
   4 r0 C0 q: h4 |0 f+ x+ c) i/ j- c
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
4 E9 _1 C% i; d* X  
, {- ]# X! T1 }# f  Minimum = 40ms, Maximum = 51ms, Average = 46ms $ d% D. |3 b2 B: p( j; X3 H+ ]
   # [- N& r) u3 {+ A8 S1 U( \
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
4 ?: |8 M1 _6 J$ s! a7 V" _  
* h9 o- O' X1 [4 q  -l size Send buffer size. ) z2 _. Z9 j/ f3 C6 @/ Q' d; ~5 u
  
: v7 a" e! g2 M, D  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

强大,但是我看得不是很懂!




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2