Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 T2 j3 d8 v( C; v, ~* A
  
7 m3 q. E( R# c, y; t1 P* o  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, z$ c* g5 q6 e6 d2 n: U7 @* w   ; {# f9 s$ k- r
  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 # y7 G9 a" V9 [# t8 U
  
( u, X. A$ s5 h5 e( S0 G. I  Options:
/ N$ d: t9 H; \0 m( c  
: C# ^2 Z$ g1 \7 w1 M( b  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
6 @! B7 U5 l! U  
4 B& j# ?; f  E, h( c3 {) G( O) R  不停的ping地方主机,直到你按下Control-C。
% C5 `* W7 a/ s+ g   0 b3 ^: F+ e: o$ V& x+ V
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 4 }" d8 C# d" T" Z6 ?
  
2 o* V  E7 v' o0 H& Z  -a Resolve addresses to hostnames.
, }# G5 S, H, R- B   7 T4 L! G- t. V6 b" g2 J
  解析计算机NetBios名。
0 x5 {, ^( W2 f& J$ U" a; v+ q) ~6 t   - i' Q3 u  Y7 i
  示例:C:\>ping -a 192.168.1.21 ! s- m& c# m. z7 Y5 B
  
) ?% W. I- i/ ?0 Q+ \8 i  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. k$ _; N' S& {9 V& r) z; t   ! ^2 R* w8 l' {; J; h. ?; P
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' i- M' N; F  _4 e- t
   8 F- X7 N3 O. t2 c2 y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. H0 J( R* Q! J; M+ Z5 x  
* S/ a7 W9 E/ q5 Y  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / g4 a! P4 m% }. t
+ N, Y1 _# |! n% P7 }) x
  
4 @! o# z# d8 K2 l$ a* c& i) n  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' d5 j. Y9 I. N* V: D8 g. ^( A# `
  
6 @+ i' c: O9 z$ j6 h" V7 _5 M  Ping statistics for 192.168.1.21:
6 E( b* d# r9 N6 C! q' z; I  
% e5 W: Q9 ^4 i4 x4 W  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 t* k# a; P9 q
   9 j: c& X, _  \6 a0 w7 D
  Minimum = 0ms, Maximum = 0ms, Average = 0ms " Q  m: I" p' T# _' v
  
' m  Z- O; r: L8 d) o" k) [, z  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
% Q7 K  n: l$ b$ a   * h) H4 v0 @  f; B7 j
  -n count Number of echo requests to send. % B0 K; d1 H6 o* O# x$ Q
  
" B3 x8 z7 ?( p  发送count指定的Echo数据包数。
8 q( K: h% g4 M/ o   " x( Z, }. m" s6 P+ H
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: + F( m) ?) ?+ @# {
   : h( t4 U: _! \8 M& H
  C:\>ping -n 50 202.103.96.68
3 ^' I9 X& M5 ]4 T/ d" f8 k5 q  
! v, b7 s8 [" D2 ?0 V* f  Pinging 202.103.96.68 with 32 bytes of data:
; `1 i: q2 [- g* _! q0 z  
9 w6 x) i8 t: ~4 V' _1 B; q4 E  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( x6 f9 [, G; z; ]. \  
" h$ S* c1 t; E, D' Y- w  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% I: r2 Y7 Q% }7 Z6 i3 P" S   3 F6 x% |4 d5 L  J- U
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 u8 b* d( [; Q* o! i3 Z
   ( c2 q& @" W! e5 `5 Y! @
  Request timed out.
2 c' A* E7 ^# N8 `   3 n3 l6 C3 K% X  d3 @% \
  ……………… 4 J! p: u: W; ~) D8 u
   + z+ Y& G6 ?7 K4 b( n9 T4 g
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 O5 V9 n# e# X5 k  X   * h( v" y' X% }
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 p1 Y+ J0 g5 u/ [. e; K- F$ h4 M
   1 M0 t4 r- q% ^
  Ping statistics for 202.103.96.68: 5 I) w5 a: _7 g, z2 }
  
+ _! }9 n$ s0 c! A) K  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ c$ p" P/ V2 z& l6 B2 o& y   ' J# d+ x& {7 T5 @* H# N1 Q
  Minimum = 40ms, Maximum = 51ms, Average = 46ms 9 _& q$ }& G, M* p3 _8 }2 X1 }
  
. F. k& y' s/ Q* o6 C  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" j# i7 k0 J9 [+ G0 f3 b   " v3 m  G  I" ]9 S: N+ b  ~! g" T7 Q0 D
  -l size Send buffer size.
/ S1 r# B, \5 B' N5 Y  
  n* X" P$ A9 R: S* C2 I% N. g  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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