Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 C: \6 q% ]& Z# F% S. ]: g9 Q
   $ H) d- N& y% _8 |
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# l0 J$ Q( u7 [6 N   8 @! R% A/ K+ O4 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
9 [* I  r2 d6 S. b1 u( ~- j  
7 u' ^+ z3 l9 d2 n  Options:
0 e! q7 C% J, w9 }2 E5 S  
. E2 C/ O: l* g5 B4 M3 ?. Q( V/ C  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - d% N  p8 B. L- S$ y
   . y. A0 N# ~' s% F3 O
  不停的ping地方主机,直到你按下Control-C。 ! f8 r3 ~- a- a1 o% \" e
     o% E- Z( U- [" o% z- n% V+ H8 v
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。   b8 g: u9 g4 R6 h# T
   ! p. F  p& Q3 @
  -a Resolve addresses to hostnames. - r/ G6 e1 n2 l" I; n
   6 ]$ b) w; O0 R4 P
  解析计算机NetBios名。
1 n* @0 Y" @8 z/ `  
$ z$ R2 l8 ?, k( t/ `  示例:C:\>ping -a 192.168.1.21 : o, x3 K% ~) K2 ~# k, B8 h7 O
  
) f( R5 P2 n0 [1 r) D, {  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% X! d# M. O  c. v' q- H  
# L$ h  q4 B4 _  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 @1 V, J) `% y; G; e   / q$ v) S2 c! u  g& a* U
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' C! s) }0 N* E' m; l
  
# x: A1 ]% n9 @+ w3 {  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% |" H: n  t% B) Q5 s1 Y' c! l  b! D) r' D9 ~4 w4 L
  
) U4 n1 i# D8 d7 E4 `' [/ b  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 `4 [4 t: z0 Z+ a; ?
   ' X+ g$ M* S( i6 a" g& y! V9 d
  Ping statistics for 192.168.1.21:
+ c; S5 B2 `% @/ t3 v. z, Q6 k   " X  C- m7 U+ c2 g
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 }+ o% e4 o% B! g& _% y  
5 W6 A) x8 g! {- w  Minimum = 0ms, Maximum = 0ms, Average = 0ms . V# \3 W: N! S% S2 h
   " [  u# @" ~% u% O) \3 }
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ' x- d# `; s* y6 m% O* I
   2 v. Q- a: z: G0 Y! V
  -n count Number of echo requests to send.
5 \' d( t' x0 ~  
% u- H- A' A$ B5 [  发送count指定的Echo数据包数。
. w0 L/ C: ]) s' m6 s9 W9 u; u  
& x5 p% r" Q" F3 E$ [  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! [0 S3 j+ d- y& U   ; L7 h$ Z2 K( _/ _; f# `
  C:\>ping -n 50 202.103.96.68 / |& u/ [& C2 }8 z# ^" Z# q* n
   " w2 {+ B% e9 n# s2 n
  Pinging 202.103.96.68 with 32 bytes of data: $ i, i! o. p2 r6 w# ]# b
   3 B; w8 x8 x$ b$ t# `* _
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 k: ~5 C. l. o
  
2 k$ c+ t! H7 Y5 O  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 s  \5 M/ U  N& t4 [
  
/ X, \! c# E4 G! h1 y" K  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( o) l% T0 d6 B/ g  
& ]. T0 U+ U8 m% `4 j  Request timed out. 5 k) Q$ x6 ?6 r. N6 @* @5 r, j
  
3 e* C9 ^( S9 s, b1 v/ \" u  ………………   {5 |+ X- W; u' o: |  _
   # U. O8 J  k6 C% d3 a4 s: `
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 c; {0 h/ Y8 v# u3 O
  
( L; O) `4 Z; Y$ C( K3 \6 b/ A  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * x6 n  n9 z$ s( }
   * Y8 ^& ^0 d8 y! @) O
  Ping statistics for 202.103.96.68: - G3 U2 K' v% [7 G0 K0 N6 c( q
  
4 |! `3 Z" c& s( F  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: " L# M' H  f; x. f9 V
   ( W: ?/ G6 ?! ^5 o
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
( N" h+ l1 A& w2 R  {) D# Q   : `: F9 j. x" s* [3 Z" B5 D& ]/ S
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
5 q8 [% o+ g7 u3 l) d  
1 y- j9 @( v8 H% F0 V* }" N  -l size Send buffer size.
7 P6 G6 s' C4 N/ X  
- P4 T3 r' `4 d6 m7 B/ E  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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