返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
0 b9 M8 Q0 c8 B! I" v8 J  
* G' X. E* v  F* z. J  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, u- o. Z& a, M* d$ E" K   + D1 z9 K3 r  L
  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 % m4 e  o( W$ S; M
  
. w4 B% s2 E7 _; j6 b! @5 X  Options:
) C3 H4 o1 k. C% ^/ Q; W: A- s3 `  
6 J, A  R, p( m/ d' L! m6 }  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 3 G% f5 Z; I* L2 T% m
   9 k% |8 v) m1 P+ [
  不停的ping地方主机,直到你按下Control-C。 6 T0 d' Z, E1 M3 o
  
  N9 K( @8 `0 b; S7 d  J: T  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
8 p' U2 L0 Q3 K4 v1 d/ s8 c) I   8 L0 o5 `  d" K
  -a Resolve addresses to hostnames.
. \3 f6 p  r" d2 l  
8 v& D& u6 A0 ]  解析计算机NetBios名。 & |( a; x3 D. s; W
   9 y( y% f1 k+ a: ~- k% _
  示例:C:\>ping -a 192.168.1.21
& I. B/ U' E: c8 A! j2 x: O  
6 d6 J% E: t3 i: H, j; O* v  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
& b+ G' B5 b+ P# h  
) t* T9 S  C7 z3 N& F/ F  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ L4 Y  b- T9 j   # c% _  z4 m' ^$ f( T
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 n' F9 z8 u1 v  h   # Q" t, o) a5 Z
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 Q5 n2 l) [# Y1 z8 c: O  E
) c+ C; X' {" o8 X5 D* B% q   ) d6 B6 s) q- f2 T
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: {& Q, g+ Q4 O3 J9 d- ]% K   0 B3 y9 @$ q  f
  Ping statistics for 192.168.1.21:
. x0 r, J7 Z3 P3 F  
/ d2 ~4 a6 R' \6 E% e8 V" u- Z5 F  G  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
$ c1 V" K8 K$ f1 _6 n. x   8 q& |8 ], u% T8 T
  Minimum = 0ms, Maximum = 0ms, Average = 0ms & V* s( P! D" @
  
. [* v+ A& v8 U% ?# o! N: z  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + {8 C# q' H9 N" h5 M5 j7 P( u: E
   0 i9 k1 ~+ ]  S/ I  E
  -n count Number of echo requests to send. 3 @5 g0 B5 A. e. l6 G
  
5 t1 t. a  [0 ~: M* F1 d9 u$ a9 T  发送count指定的Echo数据包数。
, P# t9 y6 o! V, T. I# U4 X   6 t/ w8 u4 |2 g7 q7 G$ Q# J
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
; K% e6 V0 v: e+ z& G   / T; X6 [6 l  j) N3 h6 e+ q
  C:\>ping -n 50 202.103.96.68 % t$ E# m6 X, `" P
   3 x8 e6 [6 h0 b/ c/ l* {
  Pinging 202.103.96.68 with 32 bytes of data:
, c/ Z; b+ G8 g! c" l   ; w, F# C8 B0 U5 P$ T) \, u
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & T  D/ ~; q2 e$ _7 ?
   # R( }! L  X( I
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 I4 {$ H/ j# p7 T7 I0 D4 S
  
4 m* ~: S8 {  I$ }. T. o  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" @( g1 [- r9 L$ I3 T, g5 w" X( A1 ]( Z   + h6 h, [; a+ V" q/ v
  Request timed out.
; T1 J* @" l9 o* o  
# v! k+ r9 L7 ?  ……………… : o+ t! O4 Y( `! w
   - r" \6 v% F: _6 Q* y9 a
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# H! t& W) o3 q: v& o  
% X. l3 |% L) x6 p9 Z4 Y7 P- |  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# u8 `* d) z& a0 i8 J  
6 O/ |2 a' Q, X0 I2 W  Ping statistics for 202.103.96.68:
5 c% e& A# G; X+ R; W; Y  
0 O. a6 P( n/ c* |: S% L$ T' \  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% S% N+ h2 V$ ]9 B; q9 K  
& H5 a9 g! n: l) N; J3 j2 [: e% H  Minimum = 40ms, Maximum = 51ms, Average = 46ms % P- ~7 L- d! c7 |; o
  
4 g9 `" A! M, R  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
: q8 g- q; x6 k4 T( L   3 p. h8 ^; G. W$ E) }. R
  -l size Send buffer size. ( N, Y; q0 o3 S% B$ b
  
' }* K7 N9 I6 Y+ ~  定义echo数据包大小。
89w.org捌玖网络

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

TOP

返回列表
【捌玖网络】已经运行: