Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 J: |9 q4 Q. g$ T8 q. Q7 R* `6 K
  
% w6 {# ~" Y9 o+ y' |" x  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ f) R9 _& P/ L! y" U  
' F+ j: N9 i  h% m; A  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
0 \2 @. g+ B& j9 W! m4 E- G   5 z+ i" R3 L9 ]+ w4 g8 h
  Options:
  E% ~4 h$ ?# Q9 @2 N( |5 b  
1 I  |3 [0 _. g0 b6 H0 o9 Y% l' s  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
" V) |3 P3 X5 M# A  P& C2 G! p8 i  
( s, x7 d+ g+ z6 |0 V% _5 N  不停的ping地方主机,直到你按下Control-C。
4 ]5 |% d9 |* ]' T0 n  T( p   ( Y- E6 ?% g1 ~) G- J9 j" H
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 " B6 j, x( L% J, w8 V; B+ W
  
* y. f- z5 U4 ~) P  -a Resolve addresses to hostnames. 8 Y. b& b( I' W
  
5 Q3 i: s( i; O: o9 G# x7 d  解析计算机NetBios名。 : Y6 G. T% k! F8 g. v+ H
  
/ n8 o" _- K$ Q8 d/ a' R; ?  示例:C:\>ping -a 192.168.1.21 8 i! Y% b( _$ Z  F
   - X% [8 ~0 |$ \5 }
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
( Z" y1 i( D+ h7 e8 T  
8 i) z5 x2 @7 b1 `' b. p5 ^  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' S- ^( E3 t6 Y( K! V$ l8 Y3 [
  
7 Y$ F$ U) E! g3 C! y! N  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * k2 U/ E, U# _* u) K7 T2 `
  
4 `  X% A# \) l  ^' o6 f- o  _. ~  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 u9 i' [+ m/ _; b; Q
8 ?( l* P8 k2 }( Z  B   / [' f4 C9 h# f6 k; C# J
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ C( O+ u- g. S: g) v/ E  
: b& z3 n* }! {7 ^0 ^9 X: ]  Ping statistics for 192.168.1.21:
1 t1 P; Z4 x7 u; I; }  ]( `2 V; @   3 y* t: k5 u: @0 L0 @
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: * J0 _4 t# l+ _. |( e" h; K
   * p/ S9 J/ I7 G
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ X% l/ b( C- v2 a; j1 S0 x   : f4 `0 i& T  i# F3 k" v$ u
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ) m( C& X' d- C- b% a3 W$ k
   / J: T! u* D+ U  N( }4 ^  K) Q- N
  -n count Number of echo requests to send. 0 ]3 g! m0 H0 h3 i) P9 J; k
  
) n* K! i1 O# V2 g  发送count指定的Echo数据包数。
) i. x6 X7 K; Z$ E# u- @  
& J$ c0 {& n" Y" s  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) K9 U! ]0 c4 j) e     k3 \; c$ M: ^0 V
  C:\>ping -n 50 202.103.96.68   O  Y2 v! v& U
  
( M- T/ b6 e4 t( m# V" e* \  Pinging 202.103.96.68 with 32 bytes of data: ' u2 W4 L* e% N# {. W
   1 l0 U. W2 N* l9 u5 D8 Q
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 W3 i% c) U7 g- }. `4 \2 w
  
: q& f+ V+ _9 q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! B0 T* G8 g. R' f/ J   7 {! j! \$ e, H2 z. n( W
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! M6 M& E1 _$ A! n0 I1 ?/ l4 X
   5 B. U- W& S1 |
  Request timed out.
6 x% B/ [; |+ Z- `1 {5 s- A  
. A4 c# V0 ?: h- \8 p1 w# G5 e  ……………… / t6 ]+ h0 y  s/ g. |, e% o
   4 z. r- |9 V& `$ G1 K0 L5 X+ c
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) H& f! \3 j5 U* @9 b! G
  
& _& h5 `  }. J; Y! S  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; }  M, k+ ~9 S  G) x/ }% S* H2 a
   : _( f2 h* P, i/ k  B( g
  Ping statistics for 202.103.96.68:
$ y) T6 j  E* w' p   9 T* f  K/ Z0 C1 W2 {  Y
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: $ j. ]6 Y3 o' S
  
# u% w! e: z1 w6 d: Y# u  Minimum = 40ms, Maximum = 51ms, Average = 46ms
# X* f/ p! e' z( \   ) \: e, f' `8 g' G) x: y3 m' C
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( m: P  |  m5 t9 T/ S2 ^; q
  
# E5 b; m& M8 _3 b$ {  -l size Send buffer size.
# T1 ]) T9 Q0 `! R' X5 C- Y  
# v7 ~" R- p( I# Y  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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