Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 x# S3 U" l. i5 c% S' O; `+ V
   $ }& j: L+ D! `5 b
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: + e+ S2 c5 H$ X# l( e, x2 J! s
  
" O1 ^6 p( B/ S. G; @* B  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 g& r  v* N; Z5 U" w0 u! W0 b' t
  
/ [, o6 e: L  g  Options:
" u/ a8 a3 k! t( S   ; C7 |, q. y! S, K+ \( \/ F5 T
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
4 H/ t" g) M3 u; N% }+ l   ; V* j$ i6 V* [" z6 i' a* s
  不停的ping地方主机,直到你按下Control-C。
5 O# \9 s5 s& J2 E5 l   , R( m2 _+ N+ O
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( s* m3 ]( y0 K/ i  v
  
1 n0 J& B2 S4 Y) ~% N1 Q+ U  -a Resolve addresses to hostnames.
3 l! P$ o' }8 w* [/ c& E9 s# F- U  o   - k7 c9 J- q9 y: k& G: U- {
  解析计算机NetBios名。
( d) P$ I5 k$ ]2 A   ( c( @" S: M" ?7 o$ n; J
  示例:C:\>ping -a 192.168.1.21 8 o. W3 h0 {  b5 O! L
   . z- k6 b0 E/ v" M
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , R8 ?0 ~$ {  C1 Y0 W% h
   6 I% ?8 P$ L' r) T) A( g& @: a
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 m. c9 E. |. Y# H" h  
5 T+ c( h' \, ]" ^  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 z  N  v* Z: v/ |( }' A6 O  
/ H- d2 Q- U! U, J9 x  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 J6 ~; o' t) L; f9 m7 z8 z* {+ Z* A: v+ J' n  Y  p
   8 H* q4 U* X$ Z1 T* |
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 B: \5 Q6 Z) B/ c- \& G
   8 X+ X1 h! D: z" }9 e5 Q" b& |
  Ping statistics for 192.168.1.21:
5 e2 K2 H% I6 _2 o) C- |# y, O% Y   * e$ c- g3 q6 H. T3 A
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
' h+ c3 g; i* _# S1 F% c  
  \7 t# t5 b+ d4 w. K$ x) T& E$ o; d  Minimum = 0ms, Maximum = 0ms, Average = 0ms * c- w. {$ m2 S( @3 q7 b
   - [- U. ^* ]# Y5 y( d: B0 p, g
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 & x8 s$ M4 W5 O2 X2 U- n' e7 v
   ; u3 P& }& F* r3 `* E
  -n count Number of echo requests to send. , L3 R8 K+ A1 M9 x7 M
   + A5 w# V  ~+ K+ M% r
  发送count指定的Echo数据包数。 ' D" S$ S. b8 d5 |
   6 f, Q. f2 l4 ^4 t
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
; d4 {$ r# W" w  
+ D0 @6 |. V# [/ j  C:\>ping -n 50 202.103.96.68 2 Y+ D% z/ F6 S/ G9 q
   4 h4 M; R' f. U4 f2 i7 F' C$ G
  Pinging 202.103.96.68 with 32 bytes of data:   D3 l  \* b. [
   / U! w6 a7 Z2 o  U
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 D0 i" Y  |2 R/ D8 O5 X* R' `
   4 p, c0 X. ~) e) h$ |4 T: m
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 U2 n5 P5 D5 a6 T1 [9 g
  
0 d5 J: Z% P; c8 h8 p  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  E. W1 t. \7 A+ O   & Q. u  s$ T8 Z5 O# u( r* M! y
  Request timed out. & c* q/ N0 |4 d, ~
  
& z. k6 U5 a$ z  ……………… 9 q! }5 Z, S7 F2 _; e# _% T' T/ a  C
   6 ]5 q: C1 B% ]
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & d* s6 V2 V+ C! q" k) _
  
' T3 C; P( Z, o- g% \& ]- w  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 c7 `, }1 K* B6 A7 |
   3 {: D, n9 e9 Z) y
  Ping statistics for 202.103.96.68: / ~6 ~! B- j. a" E4 D4 D
   . ~7 q) g( H) N: @% s
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ l2 \% B% h% G- b- ^; ^  
! o1 X4 R3 g" z$ E2 d0 s  Minimum = 40ms, Maximum = 51ms, Average = 46ms
' q7 d1 |/ l. J7 x   2 h, N. j* O! |5 N1 X8 i$ g* T0 V
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 J7 q& G  L! u1 _
  
! e; I6 M3 d- r$ s' Y$ F  -l size Send buffer size. 1 A; P5 _* T" a1 E0 s
  
1 }2 `0 ^6 }* y  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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