|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
' P# K# T9 U! T, r) @ 7 q* T2 K; O, z. D0 _
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) M0 h2 @! q$ H5 @3 \& i# J0 j
4 _( Y; Z6 D O& \3 t 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 ) {+ b7 }+ F5 P, w
9 G0 g7 r. T! p! v& B' [/ ^4 x Options:
0 s7 L1 Y! U6 R" v* g, z + K- W: y0 p0 n0 n3 L
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. y- e6 I8 c+ b0 A. m
9 S. O& s; t0 ?3 A0 D7 o
不停的ping地方主机,直到你按下Control-C。 $ T3 z, [: J0 J6 ?
% j1 ^# i7 v% y( p) w& j 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" U: R; K/ T) \ . ]: n) C9 B" L& p
-a Resolve addresses to hostnames.
% W0 Y( [/ ?$ q 9 F8 E" r& h+ ?2 w* j
解析计算机NetBios名。
8 v# z; a# Q( `. s' _8 H' I+ f $ w8 Y# k3 v! b% y( S8 l! d
示例:C:\>ping -a 192.168.1.21 % V/ h- q0 G0 D2 z2 B$ s
' r. _* l4 c) g) e# n) t
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ) D- @+ E) d9 x. M7 \1 @
! b. o i" W9 G5 C9 g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 J. Q3 c- K& y1 i
7 P6 e; c$ O8 @7 h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. Q) v) A+ i# j8 ~5 L & W. e, t7 {' T/ ^+ U* ~3 Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 Y0 S! N9 q) Y4 G
; Q( ^; U( t4 S3 ~ ; L5 [' {9 A' ]) C2 e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , R, e% s9 ?+ }1 e' L! P
( E b; u8 w( R. a! A% D6 b
Ping statistics for 192.168.1.21: ' t* Y4 b, {8 @( H X0 b
% c! |5 c# C$ Z* F+ L: R
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( r0 m8 m+ a" V- b0 c
W$ A( ?7 M/ Q; \# E Minimum = 0ms, Maximum = 0ms, Average = 0ms
F( l9 M8 ?* L* N2 j$ l5 @4 Y! t
$ H. W. R# J3 t6 S' A 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 , Z5 x; ~" `* l) B$ Y G6 G2 g8 ^- I0 m
4 C% ?& N8 ?- a# a0 y4 l% } -n count Number of echo requests to send. 5 W! x& I4 W+ U6 N9 J
$ h. k3 }! d" }1 h
发送count指定的Echo数据包数。
& V6 X, ^& L; ^" P& B. Z+ A . z5 d2 |1 }* o
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 J& G5 g+ C! N+ a" T8 c3 l, R. f 8 D9 e2 c+ q/ e1 E6 x! g
C:\>ping -n 50 202.103.96.68
8 n5 N* y! U, i! d0 b; Q7 z
! C7 [! f8 `, m Pinging 202.103.96.68 with 32 bytes of data: & [5 x- [1 t) q& z1 B$ r. L! ]
: T6 I5 F6 z6 k, `; e- T! p" j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
{$ v4 x& l3 N- @. W$ p; P' v 3 L5 i9 x( n2 Z* h1 y! [: i0 t( R: p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 c, h3 |2 g2 f# \- c
, F" x/ A7 b. M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 z" L' M$ {1 U9 e# k7 f
: w# G4 U: i' m* z# {1 w4 J Request timed out.
# g4 z5 `1 D/ U0 l- q- F
* y4 X T! L% A$ v/ J4 G" t ……………… 6 `3 v2 @! M# d+ e% [# T
. Z0 k- m) O- z8 ?7 D$ F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / }6 Q0 Q, l6 V/ x) a7 u
3 g: C# n- ]* F, ~2 C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 q7 B2 H! z' m, e! `
4 \) Q! A% S' O- e) S6 S Ping statistics for 202.103.96.68: * K, F3 R H3 A/ ^9 ]& H' h
" R( b! \' c' K9 G: x& y' F Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
6 \0 U# N. d6 A: H 8 w* q* g- {( j# e+ z$ D9 F
Minimum = 40ms, Maximum = 51ms, Average = 46ms ! C( o* d4 U( S* p, R" ~9 a) g) l. n
' U* I0 z( t8 g1 ~
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
5 u v6 C5 T/ ?$ a" N
) m% \2 h9 r3 E -l size Send buffer size. 6 |: k% Y( F7 q' c7 q
}, X7 ^/ u% k6 w2 Z S
定义echo数据包大小。 |
|