Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 - o3 ^/ Y" l' g; }* C
   % X& h4 O+ R/ u6 ?4 H" k$ j4 u
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. A7 W4 W% \% ?# W   " T+ ^0 T% o2 }1 o/ `0 X
  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
1 g3 l$ n$ I' I& @" @! g  
1 I: s; O4 f; n1 d  Options:
/ Y# I7 q6 U6 i5 Z& d9 W( R   4 J) Y1 @  |0 \: @* l. {0 W" i" z
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
+ _# r0 b' x2 C* }   * i6 P3 o1 p" @$ n6 m- y
  不停的ping地方主机,直到你按下Control-C。 6 U& r; V6 O/ D0 E6 l
  
! @/ @( n* p; t9 c  ?1 E3 }. ]2 _  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) A; h. S" r0 P% `3 C# ?
  
7 ?- O' d( ^! l' |# x/ o- p4 a7 n9 G# {. a  -a Resolve addresses to hostnames. 1 v) V0 [" U- P
  
) j9 J6 O3 Z3 }  解析计算机NetBios名。 - u4 o9 O8 X: n; w1 i2 m+ R
   : j+ D; T" Q6 `- ~2 b' L9 T
  示例:C:\>ping -a 192.168.1.21
" [& l2 Y: ^6 a- `5 w   6 _' g4 l9 A; [! g7 w) c* q: Q
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ' g0 a0 n3 M  B, A+ U+ m
   : t; m1 @3 _) H/ \, H* x! f# I
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 M6 E) [2 c* A+ |% l4 _   . Q' l3 F8 f* ?0 O- s
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
  R5 b6 O" m/ i# E2 P4 b3 w" j   4 j9 ]- I$ K0 Q' i. k; w
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * i% s5 j* D' w! u
: q! O. h, A2 J5 [0 v) @
   $ t; `2 a- d/ S! c
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 s- P" L2 i& b$ j) z' n5 k0 w  
" Q& S) {9 S: Y8 k  Ping statistics for 192.168.1.21:
5 l7 v% z( S! t3 w1 w: p( x  
( I+ w, o9 z, N5 D8 H6 N  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 i" D" C9 |4 C" B4 D
   6 \3 \8 W/ v! m9 l
  Minimum = 0ms, Maximum = 0ms, Average = 0ms 5 b" r; ~5 ^2 X$ t  d! J
  
+ S6 J5 |' f: j3 L9 Y$ i  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
6 b( A; w+ r# g/ H. V3 @: w   0 |8 f( Z* _8 t, P! B, A4 ^
  -n count Number of echo requests to send. 9 |( V  h2 Z& [9 k. r5 _
   8 H3 G' \3 E& F
  发送count指定的Echo数据包数。
8 |4 B$ _- b1 d( y  A1 _/ N$ `# W* ?9 K   $ |  r  q- z9 r
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 c6 X' e$ s7 }& v/ l5 a   ( h4 |* ?0 v9 B+ v# F$ R- `* m' M
  C:\>ping -n 50 202.103.96.68
. M& C- R1 v7 i4 r4 E+ C3 Z9 Z  
! W% t$ C6 j: G4 W5 m' ?5 B  D! Z7 h  Pinging 202.103.96.68 with 32 bytes of data:
/ {! }& y' P9 N: `% R  
6 C8 x7 f" ^) |+ ~0 ?# L0 T  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 x, }7 K$ c& ?' q1 ^  
" w6 Z9 }% W& |; j3 \7 d" b  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 q' r$ g& C7 d6 M, t4 B: n
   $ S5 ]4 E' K0 i: J4 u
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  Q0 H. M! Z  r% X9 W4 E. ]  
* s1 i1 D/ t( _" y  Request timed out. 4 X/ ~" v5 L  F
   ! j" G9 Y" C/ z/ j
  ……………… 4 t; W7 v/ o4 r  z, p$ g2 L0 S
  
) N; n8 T( B* M4 G7 `. Z+ a  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' J/ G: u1 _1 L1 C! y& v  
" A' Z2 n4 G! Q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 F" R, w3 Z9 F1 S7 r* E   ( p% _  x; o- x$ M; K
  Ping statistics for 202.103.96.68:   d1 ~6 O' M  @3 G: z9 y$ @' S* P0 a' m
   2 p' s* E: w' m( l, C0 y! ^4 |' F
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
4 i- S' J6 ~7 |/ C9 W  
3 ]1 y4 i  N3 s, `4 D* S4 K  Minimum = 40ms, Maximum = 51ms, Average = 46ms 7 @9 V1 A. n5 o" q4 l% x* N- S
  
7 v7 b" b, R& I+ Q/ l  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 ]: u& L8 Z; v4 U- S  T
  
1 c" ?5 R7 C8 m4 Z5 @( `2 i  -l size Send buffer size.
; T8 g7 U2 ]8 {! x% U   $ G# T! b4 C& Q2 {7 C
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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