Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! u+ t1 A+ L! w6 _6 q  C
   5 N" L, b9 L% H7 @6 F
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * B, u! P  D. e' M: A1 s3 @3 n
  
, Z/ Y' [0 v; V( H) q0 R' ~9 J; D2 ?  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   g* j0 K5 z! L8 A; @
   % B! L; J5 y, s: ]! y
  Options: + Z9 K  U/ d& O# d2 C1 ~
  
1 _% k5 c& V7 y4 Y7 t6 D  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 p- c5 ?9 V0 O! p% |6 M
   * l; F: L2 \5 X& N
  不停的ping地方主机,直到你按下Control-C。 8 W6 }% l+ T3 `' u: Q% N
  
8 T( f, ]8 U2 ?9 x) W# K/ Y  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 M( K. D" [9 G! W6 r$ l+ `
     |/ p+ T7 Z1 a4 P8 {' o' b) }( m; R
  -a Resolve addresses to hostnames. : c& r2 ~; r# \  q# i8 |
  
7 }; ~! _" r: G& u  解析计算机NetBios名。
# P$ M/ C; a1 g0 {/ b   % l. _- o! M7 x# u  B9 g
  示例:C:\>ping -a 192.168.1.21 ' f, _8 ~; {5 F
  
6 _; N; A. \  \4 E; V% n  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 0 u5 q) T* C& y
  
' ]2 |. n+ D0 d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! g  `, s% j5 C) L2 F
  
  ^" O2 H* `: A, f( O; V  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 s7 [  ]5 Y6 l0 K$ N- z+ u
  
& b$ l9 T& E" v& d7 K  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 h7 W) X7 G+ Z8 E+ v* F
9 X/ @0 l) n7 m2 A
  
: W! p% h' \: v* I+ m2 v  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# T0 j% r+ ?" R6 l% D! C   % |" u5 b* u; j( w
  Ping statistics for 192.168.1.21:
! u9 M* i( j3 Y( ~$ T4 X0 `- P   # j  V4 S: Z' n0 p7 |
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 2 ~, ~( m* \( D" V( a& f
   * a6 H6 ]  U" o- C3 E+ R/ c; g
  Minimum = 0ms, Maximum = 0ms, Average = 0ms . p3 l* M: n7 L' s
   5 q9 I7 \( \! h7 t1 K
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 z% g( V* j9 u' Q2 r* z" v% Q  
" U, q! H. }" j4 O  -n count Number of echo requests to send. 6 ~7 [7 p7 m8 q
  
& k, M/ T  B8 p' W' ^1 V1 _  发送count指定的Echo数据包数。 & K$ b9 }; o/ `. l
   * x1 D0 v+ W/ o, k, H0 g; _2 r
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) a9 u. e; j- k( j1 A! C/ ^
   ' j. Q% K! P: i
  C:\>ping -n 50 202.103.96.68
- B5 v" Y, K1 x& G% v3 }. \  
% Z4 M$ J! T% j8 i+ ^' a+ Z  Pinging 202.103.96.68 with 32 bytes of data:
! {  w: k7 X: v2 f  
# a! q/ [# n0 v  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - L4 h% C! y( C+ r
   5 x5 b5 n; U+ A7 R2 Q
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ q5 z" q7 g4 f  Y6 ?   $ e7 n; X) i" D1 O' ?+ d1 v% s
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% i, e; y$ z' S/ C   " G2 Z- v. l, @4 I8 j- q8 D/ [! R8 K
  Request timed out.
9 N4 `$ _; E: L! x/ G  
( A5 w9 T" N. e: K  ………………
& b4 H& Q* R2 `1 z   ; |. c% r+ I" e6 s/ N) S
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# A" g+ n# W( I8 f9 k6 _5 ?   ! e& a7 c4 ?+ e4 j# y$ U! c' u' k' [
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  ]+ |, g3 L, i& u% |   1 O" Q9 a& o" Z& g
  Ping statistics for 202.103.96.68:
' F- [7 q$ B& x3 u, Y/ @( m   6 X: B: d8 O. o
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 7 w$ Y" e, A2 R: M# o5 x* l" D
  
* z9 X1 }, p5 H) b  K  Minimum = 40ms, Maximum = 51ms, Average = 46ms . o( k4 Z! e9 Z7 b
   - L% v  ^6 ~7 o3 v7 H
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 }1 P# ]$ s) Z6 a7 H- c% `   ; x+ x+ O: J9 b" X3 ]  Q$ t/ U
  -l size Send buffer size.
8 S- N4 d$ ]0 b/ }  
2 x. T$ D9 }8 L9 \3 W2 w2 I  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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