Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 0 ^, S0 V# G0 K
   ! K, r/ x, f6 \% C8 E' `# K! o
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: " P% g* n5 L0 v' P
  
1 f/ Z5 F8 z4 o6 H, Q% M  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) c" B7 [" z8 V( v+ Z, ]
  
* k- o, y5 m( q# I& l1 }  Options: ! t% P' b5 e! c" z7 J
  
! x: l' A" \6 Q  o+ o4 r  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. * a! Y4 j9 G3 g4 c
   * P* o% ]. H5 F- n4 s: ^
  不停的ping地方主机,直到你按下Control-C。   P# a0 H/ A  k6 |' d+ X
  
" k! Q& a5 o4 J1 V2 P5 ~  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 + }! h3 ~( E2 ?5 S1 P5 ^
  
+ ]- r) X8 |* e: C$ x( y% \  -a Resolve addresses to hostnames. 7 K# _  P  y3 I% J
  
( H* z: a! ^) `6 l4 e8 m% A  解析计算机NetBios名。 $ k) U- T/ \% F3 \) y$ z
   2 q5 y  G' t1 F2 p
  示例:C:\>ping -a 192.168.1.21 " j  o$ T0 M. a" e/ n
  
" F* F, h7 U# \5 E- x9 O. V9 [  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* i& H+ T6 |' i- k* D! ~   : A) q0 F% N& _/ ?+ v6 I4 V
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 U! q0 m$ A; y6 \/ d" ?9 G   4 Z9 D% j1 S* k6 z
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 p/ w/ _5 [5 h% f( e3 F  
& j1 Q+ ?5 e! n& j1 d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' P2 Q$ r7 b0 B& D1 e( A% P2 D' s
5 e, H, k5 l8 M: s/ _
   ! B: C# t) X; j2 S7 X
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 h; z# a/ P. R. N3 u  o
  
: ^5 j6 M! n+ S3 J: |  Ping statistics for 192.168.1.21: ) s8 Q6 {9 w- f+ d! J" z9 d
   / I6 i5 k+ x6 E. v; U
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 6 d, O$ ]( v; }% o6 ~6 W( r, F6 d) B
  
6 Y8 J! T+ b1 [% Q2 b4 v' Z; q) S  Minimum = 0ms, Maximum = 0ms, Average = 0ms
% K) t& J( j; w* A   + U" ?7 @2 G+ |; K
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
( J& z1 H; q, I  
1 v1 J! V# t9 l  -n count Number of echo requests to send. " X+ l' B+ a7 Y7 g8 Q: b! a
   - l! h) |; U/ {1 p4 K9 v' p
  发送count指定的Echo数据包数。
& p' P6 n! _& M  
% K  K( A0 J  `9 B9 n4 Z  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' R! `7 Y' `: G3 u7 y
   * @6 M% c- V  X5 r7 \
  C:\>ping -n 50 202.103.96.68 3 ?( Q1 Y# A# a
  
( I& Y6 v' r% i) v9 }  W5 P, ]  Pinging 202.103.96.68 with 32 bytes of data: : b- R. ]/ Z: e. U1 ^4 A
   - C  h# Z: h3 j' o( Y( l
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) V2 Y5 H; r0 k; C
   9 f( r$ z  E( [. S0 S' [' g9 }$ ]
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& e# L# ]( w! O* G$ t   $ N- a4 g& W2 G
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 Y8 l; ^! I0 P2 z, T8 j   ' B. \/ _3 w+ G4 X
  Request timed out. 1 b7 G; H+ j& }, m4 U
   2 [! `0 o: S5 ~- I8 o. a
  ………………
7 Q$ U9 z9 j3 N* y' U. Z" h: A   # e+ l) Z+ \1 K4 _
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 i) c# _! x2 i, z( k
  
! {3 m( l0 f7 ~# G& |0 K4 v  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # c5 Z9 O6 _5 d  m4 Y/ `5 T1 e9 s- r
   9 c; t, ]9 ~, f8 i# n& F
  Ping statistics for 202.103.96.68:
6 l$ p' {, H# Q# f/ Y# n$ q" t" |; P  
! ?" Z2 x  H8 M3 l. ?4 ?" B* p  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. L4 U2 Q( O, o9 D   8 {! S7 C' a( u5 z$ S
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 `8 r2 ~. b; k7 s( b% U% v  
- R% j# [# E3 m0 d- f  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 , q9 b) M  _7 o$ L
   & T/ y  k- W8 P" q+ t+ n$ U
  -l size Send buffer size.
4 f* r. m1 X! `" m3 U" d  
6 _. ?3 ~6 y0 e  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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