Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + e9 U3 _1 j( g/ E5 V# c; p
   : v8 M6 H/ b! E; M0 P
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ L. x) R2 J6 {4 \* `   ; F6 m% l$ L* c  {. ^5 o. D7 Z
  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 . u9 \# z+ D1 z- m* }8 E0 F5 j- |
  
- i6 t. ?: o+ X& E  H  Options:
9 q# p7 O4 h& ]: E$ ~0 M   & o# b+ F- o' L3 G5 A
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. * A- o7 a) p6 ?; }! ~
   : Y8 K9 B" ]0 e: V: \
  不停的ping地方主机,直到你按下Control-C。 1 c1 ]8 @( ^8 \
   9 Q* n" {: _8 t: h
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * M! z/ r1 T4 h. n- L
   6 l1 o- B) o) K- F6 r* l* A
  -a Resolve addresses to hostnames.
+ R) o) e3 A$ Y4 s, `5 ~   & j$ M" _. N1 Q  K1 _' b/ W+ h
  解析计算机NetBios名。
1 Y; K+ V4 Q0 ?   ) V6 j, @, d3 j6 \
  示例:C:\>ping -a 192.168.1.21 ' t7 [: Z' v+ ~5 O2 F& P) K# T7 |
   $ f1 O2 _0 i% Q- X
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: & T2 r# y, Q) S9 Z
   # ]' S/ o& c' H  e( Y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 |1 l9 B  i- C' b% r7 @1 m, M  
4 a( k, W( R! G8 i- r9 i  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 k$ A4 k+ i, H# b6 |) m0 m   . g2 y  a0 j" V  f2 N/ ?8 R
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 @7 ~$ A. t& t. k$ F
8 a* @; ~! R3 N; P$ l: U; S( V  
& [- b7 Y) ^( }' @  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' R1 J7 b5 i8 S+ \6 Q) u
   # R! K# {4 t: Y* r6 w# g
  Ping statistics for 192.168.1.21: 2 s- S1 W' O5 p# B# y
  
- ?0 G9 l7 e( {# y  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; S, A' H: c" o' ^% T+ T5 q6 e  
" r5 V! {6 M9 J" x  Minimum = 0ms, Maximum = 0ms, Average = 0ms ' @; g4 Q- V7 U7 O/ m' V
  
* D5 t6 v& A/ S$ ]1 h9 _  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 D7 v9 ~& \* ?! j- A% b/ V3 D  
0 D/ V: y! {, R5 p8 k7 Y  -n count Number of echo requests to send.
6 B  L. y! c6 }/ a; t   * [- i* _8 f; A8 h2 h
  发送count指定的Echo数据包数。 0 u5 t, }& X, a7 w9 G* I  O
   3 [2 k2 P) o: W2 I( Z
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 G' t) a6 }2 \2 M" d# `! ]9 c( p   5 V4 h  }2 i0 n" K$ l$ k+ |
  C:\>ping -n 50 202.103.96.68
0 G1 R5 Z& V. S: }6 f0 a   " G* `0 I" ?3 }* B6 U' _, u0 s
  Pinging 202.103.96.68 with 32 bytes of data:
, A! g; @  l7 v5 |  
" y8 `( @+ B/ E  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; }/ \  l  k/ i: e
   8 |$ Y0 w* {& G0 ?: x
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 f( ^$ T8 W9 A+ z& y   ; K! O. W' G% x4 ]" k
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ P6 j( E. e" C. D" w   * J# f& g$ u$ Z- g( o" ]
  Request timed out.
$ B& s& o3 y' G, H  
- [& i2 p+ e# [7 c  ………………
  i+ g' l* k, l% N$ d" b) A+ a, i     M3 U) t9 F5 e6 ~: q- c2 X
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 Y: I4 Y, }) y, b2 D" @% q# b- c
   # M' x/ _8 d8 E' d- x
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. g, @% B# U) ]   ; @) z) w0 K  s7 I& G
  Ping statistics for 202.103.96.68: 9 E9 `9 @- ^& Q( T
   3 E. l+ J# B' M8 n! y; Y7 f% O8 a
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: " \$ z# {  F# p# ]+ Q; D! U! \  K; S
  
( V' Y; J& n4 I, q& w  Minimum = 40ms, Maximum = 51ms, Average = 46ms ' f2 y: ?. b( L5 R" o
   $ W7 ?0 i/ s6 C
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 5 F) f# T4 C! i4 S0 a4 P
  
) q6 n# A' g, G) z1 s# w# U  -l size Send buffer size. . V1 J$ A0 j: ~, k1 q1 I; C
  
9 {  o, K) j' S  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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