Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + I4 p3 l; @- N5 p  b' H1 y4 }
  
6 ?  x  q' m4 h4 \  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ' i2 }$ @1 |& ?9 U/ {; K
  
. c4 e: [8 ^7 Z+ M' a9 s) f+ i% H  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 9 ^8 p% h, O( t# I, `" M: d0 |
  
+ M1 X6 I6 d. S: T$ G' ]) }; g* f  Options: 8 X; ^* n2 y6 {7 [. g9 }
  
+ f* ?+ w- T+ f/ {7 a  i) `  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 4 {  H9 b4 ]5 u+ f9 V2 h4 [2 M
  
7 e9 t, j* b% R$ W1 E  不停的ping地方主机,直到你按下Control-C。
; C! Z# H! Q; k, r) R8 @0 S( u- D& x+ x   % }! K- M' u( z0 ]" A& I8 D
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 |  @3 z& z) t' k+ d( O, U/ u  
& }7 ]' U, y" s  s' i$ w$ h  -a Resolve addresses to hostnames. 7 }. a. h1 l) b
  
& l6 L  p, B- E; K9 f( u1 C) v  解析计算机NetBios名。
$ l* Z  n: V, f+ k- W7 t  E$ O   1 D' r/ Z' a* \# H+ F9 S/ v3 N0 N
  示例:C:\>ping -a 192.168.1.21
( [" A9 Q3 @  G* _+ a# m) e" `  
0 M& M5 w& K# I$ G/ p. c) ^  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * ]( W+ A8 C2 Y/ R" d- o
  
# p- Z# Z- r' s. L$ d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254   @& ~: {9 t) t% P% F
   $ M' j0 B7 X% X
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 P9 n; U; X" V  Y, q  
! g* Y8 R9 L3 U+ l' w9 I  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 x4 U0 D! v" `. z! K. i& c! A  Y7 \! v7 \8 b2 p$ A; d
   ! `- I0 |- [( E
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - _' B3 E6 t, Z" w- y
  
4 x& x1 S; {. h( j& W  Ping statistics for 192.168.1.21:
+ ~. G# C& K% L( o+ h/ U/ N   % c6 G8 i' a' ]3 P6 Z" M+ x' t
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 3 }$ _0 q+ q* s  _5 c$ \
  
  n$ p1 F* V# I% P3 F1 j# h# ^5 A8 T7 r  Minimum = 0ms, Maximum = 0ms, Average = 0ms 8 H2 ~2 ]8 ]0 @' T
  
7 G, L$ x7 r4 G8 b& C  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! z2 W0 S7 Y- E5 a8 `( t  _2 I  
0 p( F- r# O) _* ~  b+ n  -n count Number of echo requests to send. ! ~9 h, o- H8 B$ f- U0 ]- _( p
   2 g- W8 s9 V! D* L  k  M/ m1 M
  发送count指定的Echo数据包数。
+ o  q( j/ A8 p$ R+ d( |0 I   . R: J7 W7 d/ S1 t" p
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: " L: _  v6 y7 {3 r1 v
  
+ m; Q  d* N6 y% b  C:\>ping -n 50 202.103.96.68 - v) D' g* C" J8 h
     d* J1 `: j- v* y
  Pinging 202.103.96.68 with 32 bytes of data: . v( ?& S; V3 H) {: |: O
  
- F: D+ I- h. n2 @# _4 ~& \  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! ^* g0 \8 M7 M/ _! C- j
  
' ?* _- G9 d& q. g  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # r9 [. ~! [9 x. V
  
4 q. q6 a9 D5 B$ R( }! z  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 G  M. y+ s, [
   & f; }1 ?1 ?9 e, E+ A
  Request timed out.
& Q; c' i# ^8 T0 _2 h: l7 n& e   6 H6 P! o" j9 o
  ……………… 5 ]/ r9 b5 z3 x7 |
   4 Y& [* M- x. a1 L: B# D* V) J0 Q6 d
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " u  _4 V8 S4 A0 z1 l( x; w  \( o
   4 \: X2 ~. _# d: i# H: V& `
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / r3 z. A! s* z& x7 A
  
7 C7 c% z5 K1 ~5 Z  Ping statistics for 202.103.96.68: ' c: e( S& \8 W! K3 o' ^( z, M( w
   , i3 M, Y8 A# ]0 u. U& [- M
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 8 n; c3 p* k2 m
  
# S7 y* E3 X; l. C# [  Minimum = 40ms, Maximum = 51ms, Average = 46ms ) p: N7 m+ G& K) Q
   2 l' l8 ~, c$ i% _- e0 Q  k7 ?0 ]( m
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 w# K$ x# H3 H, g- d$ {
  
% b8 O# [/ @1 [! s  -l size Send buffer size.
) U( `& M: B8 z5 n; I. v- C6 }  
# G, W  m7 _8 d" N1 f  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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