  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 $ J( W( \2 o [* d3 L* J* D
; b' d7 I$ c! b
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ `% Y; H% ^7 K4 s , l' w" l$ p% M# W; O" Z* o2 f
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
' _. K/ f/ K9 }6 U" U4 g
7 o, ~) F2 e9 H2 T Options: # f. l- G/ [( C5 p% g
4 z4 P- g. Y+ ?1 @. T# {% j5 E/ J -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 N/ ~( o) l* J0 B8 P; s
' ?, X" b- I1 J7 F& z 不停的ping地方主机,直到你按下Control-C。 5 ?* R- Z# J2 n
4 B0 ~% F, t6 A( T! C3 X: E) {
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 3 L: a( C& ~8 L# @* S0 |
8 G/ ~2 W/ h l: G: i& [
-a Resolve addresses to hostnames.
2 ^! R) h2 P: |' U 0 d0 U' k9 r+ s( n
解析计算机NetBios名。 / r2 T3 e2 `' e+ u. G a0 Z
& F4 R& h. Q& C' z5 ]% n 示例:C:\>ping -a 192.168.1.21 % [ r) a+ _9 ]
, n5 o; S5 ~3 @$ _0 {0 H* F' b Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # R# \7 K" D d( y8 I j
/ Y) X; \3 {: n K8 Y* B
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 n- S0 h; Q6 I
9 \2 R3 e% F% Y y0 P. c* l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 C" Z9 C9 q3 c. J( u$ }
# x% e3 H% N% ?/ P4 ~! \% k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! L! ^6 U; a" b
! I' F$ |& j6 ]/ p4 l1 i
$ L9 I9 `( ^4 d, B; J2 G8 B Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . }4 s3 f! c) Z. d# Z8 x1 u- ~; P
. x8 l& U' w3 y7 ~, s. r% r Ping statistics for 192.168.1.21: $ K' \ X P. V1 s7 e
4 m/ F: u% l. Y# E& F4 n2 i. \
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 P: F/ M) l% ^& Q
! ?/ h2 l% g7 s4 o9 R Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 B# a# \1 m$ p! F, k
5 _. F8 A2 \4 n0 _# F 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
9 g. U* s% v9 l2 L8 l4 I$ F2 \/ t0 i 2 f; S& C0 ?9 w1 a/ s
-n count Number of echo requests to send.
8 a" g, r* B* z + ~+ N9 p) p. C" K0 d
发送count指定的Echo数据包数。
0 `! e( M! o, y% l # [* u+ q. w. G+ p7 ~- U+ e
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
1 G3 i' ^- f3 A; u 6 F) |5 e. b$ L% J. s F
C:\>ping -n 50 202.103.96.68
& ?, l" b, |* C; G& U8 d3 h
4 n' Y% O: Y5 _2 X2 i( p Pinging 202.103.96.68 with 32 bytes of data: # W5 h: e8 N( R5 x" K
( @; P# q7 H6 U8 r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * C8 c6 X( W0 z; I% r1 {( f5 s
* Z; j/ ?+ g/ U Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # o+ c; L4 `0 P% \" O
, `) i( y. d) N+ G$ M, ?2 ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
E$ u1 A* V! J1 t, W
0 H Z. _' L4 {- [. E) S Request timed out.
* k- z* C( }4 d1 c
% N, X' f, [% z* l ……………… & _# w$ c3 H" ~3 j& z; X1 u( w
4 M' J) Z5 \0 U# x, ~$ y" ~) m5 }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : L. R' e6 R3 C1 F! O, u6 F
$ T/ U8 j$ ]$ ^. h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 R+ j8 G' `. c- X. N8 \
& i! O5 H8 f# k0 s8 c$ ~- F Ping statistics for 202.103.96.68:
/ i a/ h& G) S+ p" G
6 N9 y$ j' ^! Q( d+ A Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . X: z* N$ j- g7 e. ?
7 r( d6 a1 }, f3 _
Minimum = 40ms, Maximum = 51ms, Average = 46ms
, G8 ]5 [) c# ~" r3 d
, P" _0 S1 A% I. Y! \; ~! Y 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
; p5 `! b6 E$ K5 _3 D k
3 G8 `5 i0 o% L6 E( K6 D" n -l size Send buffer size.
/ T) n# {! l, W( E& T! A- Z
! j0 k8 m; y. |+ I+ P 定义echo数据包大小。 |
|