Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 0 |5 G& \& ~  p# A0 w; J
  
; |* x% Z6 f' {) J1 a8 n  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ( N  Q/ P( u2 d4 K+ K' Y  t2 k# H
  
. V5 ^! y. x$ E$ `* \  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
5 p+ V( \: S& f9 o7 I  n5 ]$ c  
8 w0 j$ T& |7 p$ I  Options:
" v$ e7 K8 C" K9 b( o  
. P4 q( W2 k$ {! V/ L4 o; A  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 `* F: Y4 E& }1 c- d. Q   " K4 o5 ?* G. {" t$ D! p
  不停的ping地方主机,直到你按下Control-C。 ) M2 a( V8 R7 [! [' R
  
: U- ~/ D9 m$ O% Q9 W  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" y, ]! ?" O+ Z  
" j/ m3 m6 s6 |# r  r  C2 `  -a Resolve addresses to hostnames.
3 `/ D* o$ A% W- ]; a5 S) c   4 A4 I+ @5 q0 M  l: \; k
  解析计算机NetBios名。 + ]8 d4 ]8 x8 T+ e) H- w
   3 ~: j/ R9 z: ]" o1 y1 Y6 l
  示例:C:\>ping -a 192.168.1.21   b- w; x% f8 \7 \1 u4 H4 j7 {
  
. p& P' U1 E: i9 T8 c  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
& U* A, S! m- X3 o5 m3 z  
: x# ?9 g7 A6 Y7 J1 ~" A  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) F9 \9 b5 f- v) C: Y   9 I/ L3 s8 B: `3 \& K' C, ~
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. A5 Z$ c. W0 m   ( L5 y0 v9 E4 W# k/ `: D7 n
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 F: a  y. N/ {: I$ c0 Z8 d- ~* E; s$ W+ l$ @
   5 D' q" I3 L7 w; I( |
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) m: J+ i4 j6 ^, N: m0 Q7 h2 m  
4 p' d2 Y* X- o2 m! l3 x  Ping statistics for 192.168.1.21:
% j+ s3 n0 l) \( u3 U   6 h: }9 m1 `* ~; B. b. l; d$ Q
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ! @5 O" N% V+ N: K8 F  o9 `5 j+ K
  
8 X: i1 A/ v1 {" Q$ B  Minimum = 0ms, Maximum = 0ms, Average = 0ms
5 B4 \5 N# V; U. b- j1 c* N  
. j' ]& ~/ @0 o- C5 T, F- @0 {  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 , S# M1 `7 J  p3 w  C, c- C
   ! z7 o0 |6 b2 f0 i6 e2 m
  -n count Number of echo requests to send. ( F, {- V/ s, F/ ]6 Y
  
7 N# I* U+ z# P4 S- _" D' f  发送count指定的Echo数据包数。
. K* F: a5 o( A: I: P% }. e  
8 K/ X5 T( B9 ]; B  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: / D* a4 x( g2 A3 l6 \; I
  
: o) k2 C$ c, s6 e$ b  C:\>ping -n 50 202.103.96.68
: {% m* D' Y8 o" m/ ^# V  
" |8 K2 S) R$ B- t1 C  Pinging 202.103.96.68 with 32 bytes of data: # {$ |) U3 m# a1 h; N) \: V
   , k1 m4 x. ], C: J5 K, m3 n
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  F" S+ m# h$ }0 T! y4 n; [  
2 `3 d0 M" ]1 q/ b9 ]" q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 c$ u! Z* f, ^* ?9 ^- O2 p, g
   : j, E. P9 c. v4 @3 S+ L# W' I
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' q. O" C; [$ G1 A& c  
9 T" |+ i8 G% [  p5 a. z  Request timed out.
3 o% G, p% a* x1 d" M( |& g; B  
$ ~$ a/ \* q! g8 U) e$ `  ……………… ! j8 k, R4 R; h; t% C
  
1 U  D: _3 A2 k: d( _  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! f) n* b4 G8 Q* s$ H6 f
   " y. \8 j9 {& L$ o: @. m' }9 N4 J" r( H
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + I* t) n& m. [# H. c- R" M
  
) U3 k/ ~) O* q6 I; }1 p) B8 k  Ping statistics for 202.103.96.68: ) V' i7 N. b- F5 d: H% k
  
" F1 Y; [- O, R" p3 U  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . d) P- m8 ^3 i. V0 m' {9 V) `
   $ d# J) L  W6 S
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
! p' E3 c5 |! s. {' t9 |   & X8 L5 b+ _9 X3 ]
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
- n; G1 G2 |( H- Q- o  
8 n( z  i% l4 W5 N: y; j  -l size Send buffer size. . w& W$ T. ^1 S- ^$ e
   ' D# E+ I3 x- S8 A2 g( @9 S% f
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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