Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 " U( @+ L/ x: k: Q( C7 X
   : v4 m  @5 B* x* u2 K3 l& O
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
4 A. M- O) g; |  
  W) ^0 K3 p* s/ [  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 2 _" a4 w; d7 c  M8 O1 u! e: ]" g
   / P) w9 S: N2 c8 B8 W, R% S
  Options: & q& e; d* ~# L
   0 \+ @3 \1 T2 N0 X$ u( g: [
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
! Q5 J$ Q$ v+ A0 k/ Q  
" r& P7 u1 ?! j4 Y/ o0 ]1 i  不停的ping地方主机,直到你按下Control-C。
# R- G% j  S# c* l5 M4 S  
/ Y' D7 i1 N, p6 ~6 O7 P2 v  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 3 Q: p/ i2 ~; u# {) I3 V
  
! M) b2 K' o4 K9 u9 E3 l  -a Resolve addresses to hostnames. - C' M' F5 q. {2 w7 F
  
: |! u# G+ M, l+ J1 M3 X, k# p  解析计算机NetBios名。 % C% ~& W9 k) ]+ |0 Q5 x% K
   8 S4 P0 L5 _2 n2 q
  示例:C:\>ping -a 192.168.1.21 4 t% \2 N% }3 @& @
  
) _& }; J/ m2 ~  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # g3 r7 ~6 H9 v* `1 |
  
0 d# W( |, n% r9 y4 S0 a5 Q% o; }  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ X& V" }$ j, e4 w   ! Q8 R+ L" _; n
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 Y, B. x3 [5 V# P, S4 X3 T
   " y9 ?: s$ @- J* l4 p" r
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . a. L# n; l4 c- I: {0 Y# w$ ^6 D
8 d4 l: O2 [) l. D3 b6 m4 P! z
   " I( s: t1 N# w
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" v8 P' o1 v' t   0 N0 T; S. N0 n% K; Y0 D
  Ping statistics for 192.168.1.21:
& o' b9 z2 w* U3 Z# ~) G; i   / f% M& T: I% g+ m6 X) c
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ m+ A+ S6 \  ?( T+ d7 {  
( N; K. R$ v3 `, \2 m) s8 J; _  Minimum = 0ms, Maximum = 0ms, Average = 0ms 2 V; j. p1 g- U: [+ `& P( ]
  
+ e" w8 ^. J/ P9 P2 Q" y  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + C+ R) ~; g- c# H+ B* Q
  
. }( S$ N- J- [& }  -n count Number of echo requests to send.
; D( P3 v* z7 b( T+ O   8 D5 L  B' l) p. ^2 P0 \
  发送count指定的Echo数据包数。
4 i+ ?0 `1 J8 N( _   ) @7 ?9 A4 L- |. P' o$ h
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 6 @1 _# H2 m5 G- h
     o( r" u7 G, T
  C:\>ping -n 50 202.103.96.68 : t9 u& _1 ~4 t( ?7 h4 W0 |  g& E
   % T3 B! R: y  y
  Pinging 202.103.96.68 with 32 bytes of data:
) Z' Z# e( @9 x! A9 h$ q* o$ X   ! R+ ]: {; J$ A( k* J& a( N. F
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) T4 ]8 c8 x8 s0 O* r2 F   * x5 N, ~6 c, g1 d9 ?
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 G$ }, T' F& V3 L2 _
   / c8 |6 P* I" T! H
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  ]# S! t3 Z# G; Z$ T  
5 ?/ [& T/ _! `& K+ M  }  B  Request timed out.
- L" q+ `  P$ E1 M! S: k% @- @   9 l2 L" l! n% R6 {# ?5 f. d
  ………………
7 N" b# H, e4 T* O$ Y# L$ h# m4 j; Z   1 `7 O3 I/ A/ u# C0 r5 V$ h
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & S8 d# ]. T9 N5 X' b9 L% j) y1 L. ?
  
5 Q! P5 H' X; v& k8 U& v  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 y6 s+ m6 x* {+ ^  b   $ F+ J- J! r. i! B' q7 F
  Ping statistics for 202.103.96.68:
3 @6 e  F' R2 n  
6 k  P2 C. k. C2 G& H  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 W& c* l$ b: N, T1 d   : P; l: A: B$ Z8 I, V6 [
  Minimum = 40ms, Maximum = 51ms, Average = 46ms + a: V; \$ ~* V
   " Q; K4 O5 u9 P% s  h; F. [
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 / W9 d. x9 q3 D9 g$ M# W
  
1 ^8 o) b0 D4 _, d7 k7 m) S  -l size Send buffer size.
5 ?; k( c1 L" ?4 g6 d9 u6 A  
8 K# f/ ~; F, |, B1 ]  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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