返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。   R. k+ p1 g9 p+ P/ Z5 H
  
# w1 t+ g$ ~, E  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
8 ^. |( z9 s3 }9 c1 \5 F5 a' S6 n5 W   3 K2 U, x3 L/ v6 Y" Y. z( d
  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 u$ j: a5 U) E2 r  
* n, z( P0 I* D' G5 U  Options: : g" k2 m- E, K  b: |5 l/ X
   : ^( O- ]/ }4 x2 x  V2 W
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
6 ~, g% f- o# n+ f  
9 H7 }0 n7 B: D1 r  O! v  不停的ping地方主机,直到你按下Control-C。 6 v2 D( t# h; ]( b, @) j
  
; k# o  Q/ K& @5 z; E  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
$ x0 Q1 {% l3 o4 M2 P' g5 s   " F3 S  _" u6 P  _2 r! R
  -a Resolve addresses to hostnames. 3 L2 R# L) b$ J4 z" O+ {
  
! ]0 W- ~: M! ?! c& \  解析计算机NetBios名。
/ V* o$ C* S( k* f* ]. x  
8 d6 {5 d2 x7 D( x  示例:C:\>ping -a 192.168.1.21 ) C6 s1 k% g# [  g- U
   1 o. X' h# `# M. |$ P$ J
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
+ t+ ]& @, H# V5 ^5 R+ Z7 W) \, a  
" H& y+ Y. }  s# o  i2 s% ]  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * q; H6 ]4 n: c/ O
   6 n7 C6 I9 M) N4 H6 A: @: @
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - G' P* \- v+ _9 L
   ; W0 t- Q2 r  X$ u  i
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 Y; F; B5 O, L% x6 r2 ?" |! A: u* J# r
   ' @. @6 y$ }9 [* i2 a& H
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* |( S/ A/ F+ n! W! ?. a  
% c2 g; S& x7 K% ^  Ping statistics for 192.168.1.21: 2 R1 a0 a& e/ @+ v6 r- h+ f/ X
  
, {0 [/ ]6 _: c4 f) I( w  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # v7 }" }4 }! c3 J6 b/ B' |( X& m7 g
   , F: ~6 ~' V5 r6 E6 a
  Minimum = 0ms, Maximum = 0ms, Average = 0ms * }, F; G$ A& F1 ~9 o7 ^% Q
  
3 t& {' ~/ ~5 Q7 W8 i" _& \  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 H" w6 s( B4 s3 r   0 c0 \- o5 v7 n) R$ @
  -n count Number of echo requests to send.
: A4 n  B0 V, Y5 g) {( H  
5 b" y2 T3 R8 ~* L* j1 h  发送count指定的Echo数据包数。
9 F5 y+ l9 ~6 P+ U! Q   1 J6 ]5 ^/ L, u
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! H: X, }0 o: o- H2 ^) A6 Q
  
! H$ Z7 c5 L' V( G/ c- J" T  C:\>ping -n 50 202.103.96.68 # u8 {0 [9 I. k- l
  
% D- G( X. j1 r5 @4 N  Pinging 202.103.96.68 with 32 bytes of data: 3 g: f) A0 L- D" l2 _5 ]* V
  
3 l& a2 n" [8 D1 j# V' |  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 x% h+ L' S0 i+ H  c9 K+ o   ( g: a% \8 {& y+ |0 F
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# _) G( s1 A8 \' h3 A+ N   - d: @1 D& B( A' ]
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 n& f6 K1 V% ?/ p
  
2 s0 U6 s$ y! ]1 K* L2 C/ U+ m# U  Request timed out. 1 l, p) r/ t# u) }) x6 R
   : i) T$ S6 ?% C2 _5 v
  ………………
& {/ v6 `6 w9 b4 t. [: A7 ]2 [  
+ u% m, {" [; w  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  t& B, T2 ~  v! q7 u   0 T" p) n; G. g3 L9 H! T+ G: x
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : z! l/ k* m) w6 S
  
) S1 O$ t. J8 C/ x0 N* N$ Q  Ping statistics for 202.103.96.68: ' w- I7 z: w/ `% c; W. X( l) p; O% t
  
7 V( M% I% [( Z2 z* o5 ~' Q  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
3 W- D* L) y3 L) x( F2 {  
8 B( f7 h3 q: J2 v, Z1 i) P4 B$ E  Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 j- a4 u. X1 w% w- Z7 y! H. Z, R  
4 h8 o3 r+ ?- B  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 " j. F$ {8 M9 U# }7 D5 Q/ o
   % m2 Y! _& ^+ ]( _) f8 J
  -l size Send buffer size. % J0 N  H- d) l- @
  
* v+ W6 e# N. \  定义echo数据包大小。
89w.org捌玖网络

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

TOP

返回列表
【捌玖网络】已经运行: