Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * n, ^: E* k; W) }
   . r% V. R8 Z6 W* |! L/ p
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
7 G# f& x7 V8 w   ' G% E. _( n$ O$ [
  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
! `! C7 Y+ t. M) K1 \( d$ ~$ z   % U0 D* W+ U, D, I
  Options:
" M5 Y/ s7 w: a9 v" Y1 }  
  O+ j, m5 i! K$ S  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 8 P" y% y- ]" R4 N6 E- |  `
  
7 C, `, `9 n9 E2 P$ K  不停的ping地方主机,直到你按下Control-C。
' B# n( o: E, e. I: }   7 v) m. F; Z8 E; Z( e0 b
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. O7 i+ `0 y$ U1 j* l5 D: j; N  
& E0 q1 n3 r8 B0 ]. R1 K. @. f2 d  -a Resolve addresses to hostnames.   _4 d- r$ r& d
  
5 F$ Y. G& H4 s8 g9 R4 Z5 F  解析计算机NetBios名。
. K: t0 B/ r% \! @: U$ r9 {; ?% A" y7 j  
1 U5 G1 i3 q6 t8 t5 f8 P  x  示例:C:\>ping -a 192.168.1.21
% C' d# @4 G/ A" j. P  
5 }5 T8 j4 P3 @6 T1 {" H1 D' x  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 8 j+ z* x! T8 y) ]# w) S
  
" V' t1 p& ?& k" d' B8 z  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% `+ t0 c9 b! n0 N   * v/ S( P0 K" _& c% N
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. e/ k  k- N$ ~  
7 a+ R& P" K4 d: e# T. z  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # N8 F( V! L3 O1 N7 p, Y% X; G
" I1 J* S$ ?1 e! r4 ?: z: o* @0 j; d/ l
   ' N0 u8 h) f3 Y3 F
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : r. {2 @4 {! g/ _) z3 T
   $ r5 I- [% e4 v* T( C
  Ping statistics for 192.168.1.21:
2 @% |4 ]) G6 F' C0 e6 d1 E- }  
: I8 p8 ^  {# A. u7 B  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 o7 p4 j9 H  e- J) q% j
  
! @+ M+ W' L8 [, p4 z# z6 F- F. X  Minimum = 0ms, Maximum = 0ms, Average = 0ms ' y7 R+ k1 I8 x$ o# ]$ [
  
! c$ m8 J8 b8 T2 O! Z- T  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, Y- A9 ^- R! B# U  
7 g$ x, X+ }- S: K1 }5 [' t! b: x$ u  -n count Number of echo requests to send. ( I5 g4 p* }! k7 t7 W: b
  
, a0 Q+ ]' a9 Z2 u3 H  发送count指定的Echo数据包数。
" w. o; L) I4 S   ' m3 ]4 I3 M7 l% D3 t5 G6 \& m
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 s: S; V8 D& v' C8 {1 F  
6 }2 A) W$ Z$ K7 {  R; d; @  C:\>ping -n 50 202.103.96.68 ! T) _6 [3 t; _, }
  
$ q4 S( A3 W0 c6 _* @5 H- R0 V! f" f  Pinging 202.103.96.68 with 32 bytes of data:
5 ^* I& a1 B! I- j" d   , K: e' f" H6 p/ q& _" y
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( K( ^3 m- B* e7 X4 B  
% \3 `3 e1 f3 D  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 g4 ^0 R. X+ u9 N: H  
' A# ?4 h/ w# p! u) o5 ]4 m. @  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 f* C: {2 x8 }+ C+ W8 P
  
' n* l7 p( s# V7 n7 S# S3 _3 C  Request timed out.   V, u1 t9 l- v
   * ^& ^0 ?8 M2 P7 n3 l6 n4 ^
  ……………… # F, E4 Z$ K$ K9 m% C5 T! S  c# t
   - {2 P% @: r6 i' W1 p
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 _: ]& ~  j' _9 ]  
9 U+ K4 x1 S; i  o7 R  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - {$ h8 U6 g; s! C' n; }
   $ r0 N# i/ E; ~6 m) T& K9 N2 H
  Ping statistics for 202.103.96.68: : {- x" q- P' J4 m
   % F% R7 K9 F5 V% E6 ~4 W
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
9 d- S( Y( ]3 S/ ?9 }% M4 T- E3 H   5 v4 {' |$ ?% q+ D$ k5 _
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
: a3 U: a7 u, a' v: p   ( v  l: M4 }7 b" u
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ) Y9 H- M0 u' T$ J! {# S+ N4 l, y
  
5 `% [- O6 F8 x9 E  -l size Send buffer size. ; P3 I" Q1 ]! t& t. V0 B
   ( {% @) O1 V: N4 j  g/ O, K' E
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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