Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
- C6 K8 c+ \' D+ v0 D" z* H: o  
7 r2 }, U, ^) r4 R; T. D  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
  L3 s% o8 o! l3 f8 O, V   2 b: l  J1 a! R  z9 g* j. x
  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
9 H( a1 x) f: h0 g. v. i) ?0 G  
8 e. B6 c+ ?7 S/ j1 y5 o  Options: , ]' D, w, A5 p0 y  E3 e2 ^2 p
   1 D) j9 }1 P8 ]/ v! n+ b2 A6 V
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
2 [" B: o* W- p9 J9 G) F; k/ h" l8 u   # s, _. U% o- B. J3 ~* k4 t/ p
  不停的ping地方主机,直到你按下Control-C。 # M1 M. ?- }* h3 V
  
3 W5 ]* k6 J$ n. r9 g% T  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * m, O7 N9 W; I4 Q8 f7 J5 \
   " g# ~3 Y2 w6 S! _! u- k$ H/ z; |
  -a Resolve addresses to hostnames. 4 Q  u3 |9 J/ p2 s( ?% a
  
/ P* u' @5 U: Q4 q+ ]  解析计算机NetBios名。
: Z- D. A6 z& a- M: r9 z  
" @9 `: K3 V5 o' d/ [1 U' Q  示例:C:\>ping -a 192.168.1.21
; x2 h1 Q$ m% i, Y0 o  
* _  u1 R6 s  F  [  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- B6 E5 Z- T6 r# g4 K& Y5 Y   8 d4 k0 v; f$ o- E
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; W2 n0 G$ T6 j( J* A6 V3 Q   & Y( t. q% x, [3 s. E6 W
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- J9 B& ]/ g1 H  |  
; Y0 |0 {( h- \9 Y  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 ~# w4 P' a, o1 o$ K
6 z! e1 ^  L/ t7 u) ~
   , d& M/ c7 d" F% ^
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / ?$ q& [6 E* h- d# R1 I
  
6 o+ S- S% m' `4 ?, h1 j  Ping statistics for 192.168.1.21:
2 C' }. L: R. y6 z   0 `- K! n: I" I/ I
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 3 Z$ n& V; B5 N- N  A* }
  
  ]% w2 D0 c9 h6 d* ~  Minimum = 0ms, Maximum = 0ms, Average = 0ms
" P" {- ~& q- k0 W  
& x" v+ F9 R. l. v  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 u: x/ _1 ?+ }, K( o% `3 g   3 ?& V' c2 ]9 {
  -n count Number of echo requests to send.
) X- y9 L: B1 e( ]" R   $ f- d' O5 Q, ~& x/ C% Z/ ]5 d6 C# t
  发送count指定的Echo数据包数。 ; C; ^, X  Z: X# D! Z. s
  
  g! \% S7 \" }  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! w8 _1 G4 }" l) \3 o6 a& n- a  
/ P! ~# _- f% q! |2 S  C:\>ping -n 50 202.103.96.68 ' U: C9 R7 l2 h0 b3 n
   ) L- K& j( N! l3 {# D9 Y
  Pinging 202.103.96.68 with 32 bytes of data: + g2 O7 E% {9 \1 J; \
  
6 g8 z# w$ Y! f/ h  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , x) ?0 \* l" X# e8 J4 O
  
( n" Q) W4 c6 b% i6 ?( [! I  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 o, w9 f5 Y. F- y0 i5 |
  
6 V" T0 a: e7 x1 y+ r  N  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 A! {2 y/ K9 d2 e   % f- K. Z1 Q/ ?
  Request timed out.
8 q! ^' }0 m% K1 v& N   9 t2 N: X$ p7 W& N
  ……………… 8 h3 ^" K0 r. y- c' l. |4 @
  
) V/ A1 o3 j8 c% F) z6 O) z4 u# G  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 M5 z# F) o" g6 d7 _7 e
   * t/ U" D% X4 B; a( T
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 D3 U! z! y- F* S1 V0 D# ]; w
   8 z% [& M/ M- ^, b6 l/ }7 }- Y0 q
  Ping statistics for 202.103.96.68: - ~0 Y: Y* T& |
  
2 v# B9 w' Q( `0 y0 }8 y5 P* M1 ^  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 6 C6 f+ u) ?. \& a& i
  
0 ~% h/ k: _2 w8 [. F5 F# d  Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 B1 ^0 O* g3 R  K  
4 F- B# B& M: _' z$ w  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ Y' q( {. X6 K" S5 `$ u* h8 a   3 h4 u4 G; B+ n0 N1 m
  -l size Send buffer size. 2 ^+ L1 j4 u9 s- a
  
2 G+ c9 i, I& d  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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