Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
0 c& t' D. X# r- }' a. T  
4 l% t0 U5 H7 ]+ J6 e6 [  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 ~* ]/ ], g% v) g( X  
- E$ ?5 J* ~4 s. R4 d: W: A- q  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
$ A6 Z; I6 C8 N- b8 h0 K4 N  
' f& x: ?+ _3 s# A  Options:
% j/ P+ a* \% f& }* n) m   " Y& A  u5 l  N# g) g/ N5 e
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
! N$ }, Z  k% Y. @& b   & G9 x- [+ `5 w& T- O
  不停的ping地方主机,直到你按下Control-C。
9 r% y/ W/ O. L- V8 V( e3 ^   $ J  d6 S& E1 ?0 i4 m# x9 h1 N
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
+ D/ t" R- t* d$ F9 l! N   4 M% L. o* K- ^' \- x4 O: h
  -a Resolve addresses to hostnames. 1 w8 \" I, A( n7 Z
  
8 `7 L! z! `2 \! Z! C  解析计算机NetBios名。
3 r  x3 R1 ]" }   ( \; U# J* s7 h; r
  示例:C:\>ping -a 192.168.1.21 0 j) H* c: ?' X; H7 J. Y
   , g# k5 W7 d) U; P# H% ?
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 Q7 s3 u6 c$ b4 W/ w+ a& E0 z
  
) }2 O+ T+ p& y& P! D% q4 S  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # Q. t; F- F3 R, v8 N
  
- O- `% L# Q" S$ C  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 u$ I# _$ u$ G, `* d. I
   : V0 w# _- \) o+ t7 z! I( _
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 N  L* w2 {8 F7 ~8 g

( X5 B* w3 x4 R; F   1 t& t. b) q% ^
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 a, H) w! w! z" g) n1 O& c" b, p  
: n9 B, e( n% L: n  |! o: B* y  Ping statistics for 192.168.1.21: , I. x/ U% \6 P" P' U
   ( }' D" z/ m& U  f
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( g; _0 b& C" A6 B  b0 J- U
   2 @) }  x' |8 h: ^# C1 e4 `6 t
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
9 o# Q$ d+ i- \: Z, h' U" C! I  
- f  `, x, N- H; M: r7 J  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& C  h1 E: P  r  
& c' A0 I: c2 s  K  -n count Number of echo requests to send. 6 V$ m2 r9 a/ h- n6 ]6 C4 T$ _$ e
  
1 w: L8 ?; f0 |2 G( ?/ j  发送count指定的Echo数据包数。
( H- d7 y+ a" n) K  
8 {2 d1 k- a$ x  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 4 \$ A, X- p7 E, E
   6 l' ]0 ]/ A/ _- g5 u' X6 r
  C:\>ping -n 50 202.103.96.68
# G) D0 K: D1 N7 i   2 {- p! n/ R, q# ]2 E) `, d
  Pinging 202.103.96.68 with 32 bytes of data:
" ~. E2 [3 A; D- U! A; h5 G  h- J7 R  
. |) s7 t& T$ _2 Z# k  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 g. b6 h" Q& h0 J* T* o1 d2 i
  
2 G9 d1 u; m5 m: {9 S, w* X' W  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 b2 L9 i7 G  D& Z$ j& P   * J  R* x+ C, v' T# Z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( n2 m% H7 q3 d4 t3 ]! x$ b  
* z" Q, ?3 \4 ^! v. h9 @  Request timed out.
4 c; [% Q: @2 @' D  
( b: @- J' {3 \% r! a  ……………… $ M" `! a4 a6 Q* k2 X
  
; ^  I& Y/ P% M/ |  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 B3 N5 c4 k3 G8 @+ X5 Q
  
  U( i6 J3 b" w. k; C) r0 S  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; q6 Q2 f8 G2 t5 @5 m" u   : r9 T9 i  ?8 h* R% l- y
  Ping statistics for 202.103.96.68: ! E& P, k3 f3 Z' T' R0 n9 H) U5 s
   $ ~$ a& o6 v$ b
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & ]( e+ S$ t9 u# g
   - L1 G# f$ z% g# D. d; i
  Minimum = 40ms, Maximum = 51ms, Average = 46ms 0 o3 ~3 p0 K5 F- l6 {& |3 s
  
2 {! }3 d9 p6 e: ~. v  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 Z( m$ L7 C) L! G$ U' k& R% x
   - {& v4 G& Y  @) i$ y: V
  -l size Send buffer size.
8 v3 \/ o- a& {( i! @0 _  
3 w$ ]. \8 l2 c  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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