Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
3 f$ p' Y: V, u% [' {9 G  l   % [) ?" J0 h) N! I8 \9 \7 _
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * ^1 c8 |/ Z  m6 u) C7 B8 @
   2 J* q" y5 k4 E7 d; 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 ) r+ I0 Z/ y1 Z7 g' c. A
     l- ~# D, n+ n6 ?
  Options:
: L) t$ W* y; o. r& M7 a  
) H) e2 \# ?* g& C# l* ?' l, ~4 y* o  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 2 q. N$ ~- A) w/ s
  
1 o& z5 M- M4 K  不停的ping地方主机,直到你按下Control-C。
0 t$ O' u! R* i9 j3 Q: e( s/ K0 Y  
! J4 w3 r* T: _. x5 }3 `  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 }, A& b' A6 _4 V- G) F2 O  
+ h% ]0 `* j/ e' O! ~( r+ t  -a Resolve addresses to hostnames.
( J& y+ @0 x1 p& n9 B! {) e  
" d: c4 i- i" B0 g5 W2 j  解析计算机NetBios名。
' F% v; o! R- r% B  
; F+ K% |0 N; G7 e  示例:C:\>ping -a 192.168.1.21   Y" J- E1 B" |1 v( f4 _
  
1 q/ Y, l9 G& _+ L; r  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
( J9 j- x! Z6 V0 A3 y  
5 q  U3 U4 D2 Q  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 g* b3 ^& u0 ?6 q
   * Z; C7 G2 J& O- j% f
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, {+ k2 I4 N  P/ a) F& t  
* v2 ~, x) b/ N+ ~! ~+ |  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " G, C/ K4 O' c& T

0 Z9 m2 l* l' c3 u1 @3 @3 b7 F, G+ z  
- x0 @! B# y3 z4 ~+ ^: D  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# e8 Q9 \2 k; W- R& B$ A0 [! n: K  
/ Q( B: C* x( j2 C  Ping statistics for 192.168.1.21:
( E& o1 [8 V5 f5 J5 A  
- Y" R- s- n6 b  o  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 g6 q0 c, A# d* ~- i
  
# z4 s' v/ G1 ?. k* R  Minimum = 0ms, Maximum = 0ms, Average = 0ms
3 V+ Z/ r& h' T3 I9 R/ W  
+ H; d# `1 I% x3 B0 }0 X  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
+ n5 r, e" T. J( c' i  
' U0 J9 T9 P/ f1 {3 b8 g  -n count Number of echo requests to send.
7 L  u; H0 N) P! N0 R: f   2 s, E; R) C% i9 M$ C/ c2 x
  发送count指定的Echo数据包数。
; U# Y+ i) W$ r6 j5 Q& y  
; @* L- i  E2 k7 E7 c6 h  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 u3 X, w, S8 n/ H. S   . ?, [% N% {" a! d
  C:\>ping -n 50 202.103.96.68
4 k4 @9 m- E/ A; f7 }   - i( k# Y: \0 m. z# z
  Pinging 202.103.96.68 with 32 bytes of data:
# X2 {& }2 J; h% T  
2 I5 ~- J- ?7 S% L  u& b& w  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; e) r' N9 B% y. b% V3 ?
  
! H8 p( e! b4 O- D9 B& Y8 h  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( s! h- o& ^3 Q  {" f  
) H% V" \, j4 w8 A3 `7 n  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 j# f8 G( J  Z3 @1 h' N9 v
  
9 a( d" `  H0 t" P  {) i  Request timed out. " [4 ]) L3 ^% ?/ G
   $ `! q1 n( t+ p' S3 v
  ………………
3 g7 N* V+ K0 G+ d# D   5 @& F$ U0 {* x) d0 b1 v& P1 L: q% J
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 B# q* I/ C  S7 m; e, C
  
  d3 ]! N$ [& n/ l. e8 K& s  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ |0 u0 Z$ w. K( ^+ E  
1 }; [1 _# A* z& ~+ b; C# q* N$ G  Ping statistics for 202.103.96.68:
: f, B) R9 G& a% j4 S3 |# A  
$ i5 c, R5 E: [6 D! f( j  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 d2 J% b3 |; ?( M  
2 z9 ~! B3 s% P- I1 `  Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 W: {: Z" u( d: O4 V( t( `: y2 z   / ~& k8 x+ I5 n
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
* k' `8 r6 u6 J: L% I  
2 a- W# z3 W7 F) t3 T  -l size Send buffer size.
% U  o/ H0 k0 S, u  E8 ?2 h   7 |: S4 b& N3 C" R" [( P- k
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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