Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 m& c" b' d" ^" J* u, O' N5 c
   , c8 ^/ ~- w6 |! X  {; w% d# @6 y% E
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: $ m* Z! g8 R7 D7 o& u- ?0 E2 M6 I
  
: J# u3 s' W% d: U& }% i/ S; q2 {) W  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   o8 H; `! y  i+ E/ x! S5 w
     x9 K. u8 H# p2 x" o
  Options:
; N1 G5 W) u1 z& D( ~   ! |3 Q* M( N5 m* N# j; e
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 2 {6 Q2 d8 D  q' I8 U: ]8 o6 t
   . r3 N, W3 N# Y$ ?5 D! [
  不停的ping地方主机,直到你按下Control-C。 $ K2 v/ A) b& m: s
   4 g  o; P  c+ i! ^( |
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) m: m. r0 [9 A5 A% E) g
   5 W" I* U7 E5 `& U- J" [
  -a Resolve addresses to hostnames. 0 M5 D3 r) ?# f8 h6 w* a
  
. R- o" P4 J7 {: \( u% O- l, s: f  解析计算机NetBios名。
* S3 P6 m, v3 i% I6 M% w   9 ], `( V% Y/ ]- t
  示例:C:\>ping -a 192.168.1.21
- B+ R% B( v0 P! ^2 ]  F+ ~  
- n3 ?) a. g& ^  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 5 @4 j  R( u/ E& G  ~. s% o
  
. U9 p5 Q& F/ _$ F; f9 Y+ ^  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , K/ H3 ^1 c! E, M
   + |9 ~$ p& f* }) S5 u
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: G% c- t( i3 W" |8 J7 y* j  
2 F7 E+ p' D! Y8 b  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& L7 D/ L' \2 X- ~' V4 n& w; Y7 |3 v/ ?0 q
  
6 s# s# U! f' g! e; ~* W, T  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 ?! c( u; v% ^# x  
8 K. G' @! X( ?  Ping statistics for 192.168.1.21:
5 o; W! p* [/ m9 r4 T  K  b  
8 E0 ]9 _1 _& x% N$ b  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
) x/ G4 h6 R0 m6 W5 |  
5 |: e% Q" X0 w/ D4 `  Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 R$ v8 v/ U& c9 ?% @5 B2 g
   ( M) v, C; N! I7 v% f) z
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. C+ k- V4 X" z  
. r$ L; U+ A! G* H2 e6 t$ N6 l0 |  -n count Number of echo requests to send. # K( r, `  r& z: c
   / k5 C3 Z% O) x9 F  X& I
  发送count指定的Echo数据包数。
3 d" a7 ^/ k" z' D3 ]8 @% ^   " e% s+ r; X' \8 {0 q# j" ?
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* f; H# R/ i( i7 I# D' U2 H   + D9 u+ y* V8 l6 @- G
  C:\>ping -n 50 202.103.96.68
  q; w7 a, L/ S% @  
$ i; M) G. \& {0 z# T2 @  Pinging 202.103.96.68 with 32 bytes of data: . ?0 k  v& V3 ^9 \* l5 k+ H+ H
   9 V3 R3 F' z: i2 r& m
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! T: R( f2 ]1 }& n4 O7 `
   . Z; G/ ^$ j  R4 P2 Q3 S) ~& n. e( e
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 l+ E% O* T8 b. {
   3 k5 C8 C' M, o" C
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! R* Y/ s* |- Z0 w; B   / c8 ^( O& F, |+ q( `9 o" I1 f" j
  Request timed out. . |) Q/ C* ^" T2 h( P: V
   $ }$ @( t0 f/ x  ?  F
  ……………… 5 O$ v. y& H! ^! k9 ?  I" O5 }5 U
  
# D: [9 G/ G% ?3 H* A$ T1 @  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # G! j$ c& h/ h4 X9 `
   - g/ T5 B* N- V- N* r
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # q7 i1 ]8 M% ~' R( ?
  
, K7 r( v3 O, U2 t- I  Ping statistics for 202.103.96.68:
8 F7 O$ q3 k) d* }: r  
# S# u0 t2 `  o* R, [; {! [/ t  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" H( J4 u0 }- w- Q  
( f( J2 h; y. T% D* d/ \7 B  Minimum = 40ms, Maximum = 51ms, Average = 46ms 0 V, R6 {- u( S3 I" p0 ^
  
: N0 R2 C3 l6 N8 P  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, Z8 X7 v: S/ \% ]5 ?: z2 A   $ A2 D& z' y1 r0 C/ l2 b  A( V1 G; j
  -l size Send buffer size.
6 M- s; c6 z7 j6 G( c  
. k2 ~; o) a! r8 G' \- _0 B  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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