Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! K5 l0 ^# {1 l) X; @; O
  
. Q  n( M! K' u9 O  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, Z; p0 g/ n, a1 S0 A  
' m0 ?3 |* {. x; c$ K  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 v/ ^+ l% E& s& X  W2 G
  
# I- l7 p- i# q) U! E% f" E7 v  Options: ; \  H$ R  j. F: V& T2 X
   ! q( i2 C  \9 z* f
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - B! U/ L- T9 |/ j2 e
   6 N5 u( G) Q1 Y( B4 r/ w9 V5 D' T* N
  不停的ping地方主机,直到你按下Control-C。
- D1 Z7 l, Y; f" x  
" B0 x; z# J* {2 D) t- G  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 8 k# d% G" R3 n
   8 h0 S5 O1 e; U  Q0 V
  -a Resolve addresses to hostnames.
3 [; {) |& M' n7 g3 K  
: V: u# Y" Z! h, u  解析计算机NetBios名。 2 k# ?7 B  J  n; O8 K' S( f) ]
  
9 f$ Q( j7 X' ^2 J  示例:C:\>ping -a 192.168.1.21
, U6 W9 F! D6 a6 W% `8 ~' V1 R   - z* a( [. J# v3 k4 p
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% d  H4 Q" u3 c- E* M  
2 |$ G+ s. |" q/ \6 r3 z# l! z  ?  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " ?5 `2 w* H$ F6 C' N
   # u( q1 ]8 v8 u4 H" ]
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, N1 E3 Y" i! e2 p; @; r   $ f' d& w$ Y( S$ V6 r
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 y9 p# C8 a5 }

& M3 p$ }) @0 I* l0 c6 E# R  
  d7 @5 i7 N4 p  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 [$ a  P5 N1 ]9 p, \& F$ g
  
4 \2 R' N/ Z' `" j  Ping statistics for 192.168.1.21: - V$ Z7 D9 A" t* `/ i0 P: r& D# F" f
   0 k5 u5 S  @- w
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 7 P- @1 k4 x3 ?  b
  
7 |& l  R0 u! ^: _8 }' x8 p  Minimum = 0ms, Maximum = 0ms, Average = 0ms
' l/ c( m0 d' j% Z   " {1 n5 r8 I0 M+ d) @# G9 s2 Z
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
7 H/ N  k- o3 A" v! e, _; x  
8 M& ]( G9 m. h# o1 I  -n count Number of echo requests to send. / c4 {0 z3 b8 m. v$ r* {- F6 }
  
" `1 V3 @, @- F. U4 ]9 R8 i  发送count指定的Echo数据包数。 $ F5 e" V/ _' j8 P! g
  
0 f' e; i/ K9 B3 J' e6 q& ^  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
' u1 k6 T/ v4 t9 n$ ]   8 ~; `  }9 L/ z  U- {
  C:\>ping -n 50 202.103.96.68 9 C0 H- G, H5 R; y
  
% V2 r- `' Z( V6 {" W  Pinging 202.103.96.68 with 32 bytes of data: % i* @, t, N  ?" C; |
   8 Y$ o5 G, M, f' W# [4 w! ]; r0 s0 Z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 G) p. M8 a: g" \  
3 R6 B' L+ B1 ^  a1 b) R$ A  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' \  U# u9 b& i' a2 c   3 M9 p/ J9 G! D5 U6 M! s" D5 |
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 K, U9 ~* s- K$ x, ~
   , v$ P, V$ h9 W% A7 P1 x
  Request timed out.
7 z2 I/ I' w8 d' d# F% y5 N2 I  
, y% h) d; |/ w0 O8 u  ………………
6 p2 G3 ^4 m5 Q5 q; Q0 [  
4 V0 G2 T# q. u) k. l/ N) @  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( o- H: j# l) L; z1 c   % {! S: Q2 y6 t1 W" }" J3 l% P
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" v! t$ ]% W, e8 ?9 v( U! P  
, w  N8 \7 e+ b# D3 k; I; r1 _  Ping statistics for 202.103.96.68: ' u5 E! p; e  t6 E9 O5 \# k+ |
   ! i% ?; N' I3 Q* x8 p: |) x/ ]7 W
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , ?6 t" v, i  j
  
- `! b+ L# J. ?! g2 I* H: @( g2 y  Minimum = 40ms, Maximum = 51ms, Average = 46ms ( I" R" f+ F: a
  
( k# i( s( N/ c6 ]4 r% K+ C  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ) p8 S8 K2 M; q: @/ a
   ( v& A4 S& U% r7 J* i# M, \
  -l size Send buffer size.
5 X& Q3 b7 f- }. i2 ]1 H   $ r. Y" g6 s8 w6 U0 n. F
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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