Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # P. c0 x  _- n6 O( `' A  ?9 t
   7 {/ Q3 M+ P6 d! q; b
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
  f. ~: }* e/ B4 J   2 d$ K2 r* v2 j+ I6 ~
  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 * L" t+ N1 A; q( a% v/ G( B1 a
   , P, L; @- K& c7 L" t
  Options:
; ?; Z& `. Z/ E! I2 i; l9 Z  
! M% Z3 ^: L$ q0 u7 [8 K( a  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # E! x5 [, D4 _% Z% L( D% }2 [. G: h. e
   ! R; n! E( q/ g
  不停的ping地方主机,直到你按下Control-C。
! L5 Y/ B" O9 J  
/ Y! p7 t) x' q" I- F9 I3 w  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
2 M1 h5 ~+ t' T4 E4 N* Z   & V# i7 Q& y5 ]+ w8 W* S" M7 A
  -a Resolve addresses to hostnames.
) ^1 l# f# Q" C: [! v4 g6 t" \   & B( s# j3 w; B0 [
  解析计算机NetBios名。 & `9 v& t3 P, k4 {
   & \  L% L8 b, c9 x/ m) V( H
  示例:C:\>ping -a 192.168.1.21 4 ~7 `! x9 f* C$ _
  
6 N) V) B) o0 P+ R* Y' c9 l  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 T' w9 s- R" u& V9 q! N0 O   ; @6 U$ ^; ~% W* u9 J. z6 N/ ]5 l
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. R- o. t+ i" j9 z   4 P# O: @1 s6 @$ v* Z; M$ r$ R; j* v
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 r% P# i4 F. ^; [3 E1 A: N/ N
  
3 k$ k  R! h2 u  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ ~; _7 [* }: G8 H8 ~- q( m
! a# ?9 ?4 _4 X& Z' Y; {% s  d' _  
5 f0 s8 G0 [  ^% D6 w9 Y2 d0 B  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 v! {& P' ]! r: J8 A  
& N' p* }+ z1 Q( s$ a7 ?  Ping statistics for 192.168.1.21:
0 [  ]0 z, g2 W; W% x   # L5 Y" I+ a4 B5 E/ |
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 7 a& s6 j! `9 v
   7 X7 ~5 y% v8 q: |* l( l
  Minimum = 0ms, Maximum = 0ms, Average = 0ms - `3 o) M3 f" g; S
  
# o+ k2 x) W3 _5 H  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* D1 c4 b, _% }  i, ]$ r: [   1 @" z' m/ U/ k/ z* A2 V+ R3 Z7 i- n
  -n count Number of echo requests to send. & I) X/ P  v" d+ S4 B
  
& B) X% ?/ l: y* c7 K' d  发送count指定的Echo数据包数。 ! @/ {2 O: a  ]+ ?0 b4 {
  
: m4 u- b) u; Z! a. s  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 M, e* Y6 C2 K  c  
. A* C9 e. J* @# u% K  C:\>ping -n 50 202.103.96.68 / P) H& S$ B  J5 y8 }  `
  
0 g- v- w- E) L* X* ~4 J; k7 m& s  Pinging 202.103.96.68 with 32 bytes of data:
! N: n- S& e' G  
# s& n& L# I6 _3 Q8 h3 u$ a- D  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ J$ r+ x! |* D7 A' y  
0 y) h+ ^4 D% k- V: n) V% H  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 A8 c8 A  g+ n$ B3 M   % i2 S" m4 f9 ~) l% O  h
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # t" p$ K% `5 E, u
   7 B4 z* j6 p: V. \
  Request timed out. 2 V! L7 n$ ]& u" u1 Y  @: q9 `
   4 C9 D, G& i0 Z' ]
  ………………
1 }/ N, A( D; q3 @- `   9 N, r" o8 G" A+ s1 }
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 h" Q/ ~% D, q+ A' w% s
   ; O# W% V' C/ [0 J; q
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 p# @4 }" ^* j, m. a   0 i4 G* e0 K4 y0 }- A
  Ping statistics for 202.103.96.68:
4 z$ }/ @9 F# h3 u' f% Y: f- D3 k  
$ J8 |3 c2 ?& u, X  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
- E5 N! o, R7 S$ j/ [- V  N2 z. p  
+ f+ `7 F8 Y( ]  Minimum = 40ms, Maximum = 51ms, Average = 46ms ( s0 u5 h* f* }. |0 F1 S4 T
  
2 }  {6 t" F0 ]  @3 r' p  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 o* _& |/ ]* @5 Z: W8 t
   4 B9 g( D. `: a3 r) K: c
  -l size Send buffer size.
" t8 T( ?) O8 u# ~# ~   * k& Z1 D% b6 _
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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