|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # `' p$ a7 |& |: r# E% K: ~, j( @
' j3 P6 L! V; r* V
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
7 G, |; K; @$ w/ W/ d ' O. ]: A( y+ r) G5 l' u
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 1 d9 K; O1 U# l) \) u
) z( R( S( Y2 D9 H/ V2 o
Options: 9 q4 [- g8 F H+ @* ]! h+ O
, N C) |$ ]8 J. U1 i2 M0 D o
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ |3 t) u q8 B& T1 d
: t- F4 w# i9 c% h7 ` 不停的ping地方主机,直到你按下Control-C。 " D! S+ ]# j4 n6 V& W+ w, @( o
, s+ k0 q* B7 {9 ~ S ^
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 H- k% l7 F; |8 P* q ) M1 R7 d1 y1 s9 ~. M( h3 D5 M
-a Resolve addresses to hostnames.
0 R& c4 U* @1 \0 z
9 Z3 K9 t4 {1 Y% [5 Y* l2 c 解析计算机NetBios名。 : D# _' x( o. G" ~; ~' B: {( r
1 Z7 \8 J7 V7 d1 n, d* y) u
示例:C:\>ping -a 192.168.1.21 ! v1 r9 }( o7 r4 @
: ^5 y9 P E* U Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ R% n* q% b* l4 N* K9 m- W
8 H% n$ t& ]4 O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 i# Z5 i# p" ]/ {
s- n! K' K% n v1 J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' S0 M0 f F2 f. e, W$ Z $ N4 J/ @7 m2 |: ]$ U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! v7 [( _. v3 @+ @) x/ x
# S* K& I, ?/ c$ m" l/ G
. z8 @1 o+ Q3 l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ G) f. K7 z [: C& ?) q2 Y
- y6 T! v' s W( |
Ping statistics for 192.168.1.21: 3 G# {. ]% A2 O
' M) x3 d2 f: ]3 y2 V+ q+ w5 ]% Q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 2 K/ K$ F9 _3 K. ?( j8 y9 C1 l
+ W' Z+ G. ] C4 Z Minimum = 0ms, Maximum = 0ms, Average = 0ms
( A6 P$ y: g: z
|2 f' `/ n6 Z: e' }7 ~) c& H 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + L1 N7 r) D$ C# f: X
, G2 T! Q1 H* X -n count Number of echo requests to send.
% C* V; t, m% V$ i . ~! ]! V2 L' u; _% Z2 y! U3 A
发送count指定的Echo数据包数。
! g+ Y$ K* K- y- R% a
( C e# j. a: B; ]+ y$ E( n8 x 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
/ n# y9 H! v& B A7 S& v( R
3 e% ~4 D* l' d! k/ x* f2 u+ } L/ } C:\>ping -n 50 202.103.96.68 : o+ w+ G! o* Z5 `7 B7 q
+ N( a, H5 I$ a7 }0 v( R8 c$ } Pinging 202.103.96.68 with 32 bytes of data: ; X \! m5 Z) e% I' f$ u7 X1 g
% g8 `1 M6 S+ P7 b! d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 i$ H6 F, r7 j; M. _- J+ c$ R ; t# t7 c+ E6 G0 V$ C" P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . }. D8 P/ L. J/ V. n# l; H
& L/ `, U5 x: t4 b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, M7 x" c( K7 A; n' C2 C
# N4 F' ]! u- A% a1 ?& m Request timed out.
3 M2 ?% c8 {; l/ D; ]5 A6 X |
% g2 _" V! U# q0 K2 U( w ………………
b1 u9 s$ p+ t 3 B" x7 O- k6 {5 f5 K2 @( p# j$ _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 L& ?/ ~+ ] x ~: M. _; F$ F/ g ! w' X @2 C$ b3 n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : R8 e0 E/ R4 s* n+ G) H" j: |0 i
$ N# C1 f3 F3 E3 H: a Ping statistics for 202.103.96.68:
6 u7 X, U8 H6 B5 }8 t ) I: y1 \6 K4 ^7 k+ c+ E' T( Y/ }
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 g4 Z. V* ?8 H
: F7 e: c$ M: {' Q, e Minimum = 40ms, Maximum = 51ms, Average = 46ms ! b/ L) n' h6 }" g
* k4 V& G& u$ r, P% F
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 t8 x0 B- E' }( P / W/ _/ Z3 ]# N. d, V q
-l size Send buffer size. 7 f `1 _# [1 ?% r3 h# k! M+ o
9 X$ M' n6 U$ `9 b' v 定义echo数据包大小。 |
|