Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 , {' s# G7 ?% p0 f7 t" [4 e  |
   * `" W. h/ @( t4 h- G4 B$ S+ p
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 2 y/ t# S0 M& F2 @  R
   # }: N7 D& W% J
  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
0 ~# @& x" g2 Z9 ~% N, B6 e  
& S* g0 S6 }5 t4 ~$ ]  Options: , p: T2 U5 g4 X/ S' X8 I& H* s9 k
  
* o, _  h' ?6 P' |! n+ K' s  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 H) Z( H* O( F  
9 _7 H2 l* \5 q! u  不停的ping地方主机,直到你按下Control-C。
  W2 L2 W/ o0 z  t* Z  
+ d; Y+ {  Z+ ~) c, Y  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 K- L, D% ]1 n3 Z8 m
  
2 D4 l' q3 }) e- M  -a Resolve addresses to hostnames.
) e- N7 e" d' }9 T' F) x2 K* A   0 z1 ^9 \" D/ V, y3 ?* p. n$ ?) d
  解析计算机NetBios名。 $ L5 g/ x+ Z+ J; M8 N
  
9 b, ?5 ^4 ^; A/ J7 p) Q* l. M  示例:C:\>ping -a 192.168.1.21 ' v, n2 l+ ?2 q
   ! Q% {: q8 w" l; L9 Q+ {" _9 O% N/ Y
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: - N& g' s$ Z  {. S
  
( N3 M. X; _  w# u4 L) o) d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ O, I1 e( h* U& p: b( T+ j8 G) y+ E  
6 u8 x7 R. k/ l5 q; i  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : K/ h9 D* D# [
  
$ h1 x$ b3 F: J& J% E, Z; d7 H" I  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! v9 {8 u) G; J' y3 u' C3 G4 `6 |0 B* Q- O
   8 P, u: e( F2 D2 g5 Z
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; ]: j! {7 m2 c, H9 ^/ i- I9 |   4 @" V  Y# _4 r; u+ Q6 K6 e6 `
  Ping statistics for 192.168.1.21: 3 \+ J" u1 W7 u3 V& e" Y/ p
  
! ?3 G  j: n. h( b; X  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, b0 i7 X& ~, G7 }2 o7 J   9 R: g8 ~2 G4 n) E
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
& F6 Y5 X- P" i: J0 m   1 r1 {; G; T4 W* Q+ L* m
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: e1 c; x6 D2 i3 A   ; S% L1 M8 V9 n1 z( k( p6 E/ p
  -n count Number of echo requests to send.
. S. P) d3 C& U* ]   # f4 \4 O7 r* {- E
  发送count指定的Echo数据包数。
- c% P) q( E7 k5 L  
5 {9 |) E1 p( h( D  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( I; D- a. P" E$ k6 C6 Y  
" ^! d: [+ ^0 E, W0 d7 |6 v9 g  C:\>ping -n 50 202.103.96.68
# H/ d' n% U8 z   1 l: L* \# N* `0 P3 ^2 P0 F2 z
  Pinging 202.103.96.68 with 32 bytes of data:
. q) @4 k( }  `; B# P3 ~" P   " c) G# W! v3 x3 i
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ E% p  y: ]' g5 d  
8 }% g  B( ?; y9 c7 B6 n  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' x7 T. t6 t$ A: C5 ]: P   5 y6 @: g- I4 [
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 j* {& o5 t- G' j  
7 o: v" W1 f! C  Request timed out.
" G/ {% _) f0 [: A  
# h9 g1 u5 \2 C, B& R7 s# m  ………………
' @" B( N+ x( ~& O7 E) e" Q3 L0 A  
+ J7 q# L8 C* {" h  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , G* A0 ^% M9 w# ]( a: N
   , I, K7 b& \3 v( Z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 Y" H; d0 I. W  ]8 }4 m  F, B  
1 v; c8 r  ?1 X& m$ @0 x  Ping statistics for 202.103.96.68: $ S' R5 ?$ J( t7 @+ }% f4 R
   $ S! @' h% P" V9 g! t" O2 X
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
) B/ F& N5 K& |1 q; ^4 J, G. r2 }  
7 b9 S) y: u( d4 x3 e  Minimum = 40ms, Maximum = 51ms, Average = 46ms ! u9 x& B  m5 p- c
  
& D" p, f4 e2 }7 j; r( I; d  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
2 f1 ]$ }' r& n9 O. i0 j# h   $ W! f9 W4 B/ h- J! ~) Y  _
  -l size Send buffer size. 8 Q* S' G) K3 t9 f8 Y
   - R2 v1 u$ {6 Y" l. _" {3 m
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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