  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 . J( u8 v5 M! M5 h9 {" j3 G) Q2 z
: L4 q2 v9 V+ p5 A( ^
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
2 r+ V5 X1 ], z( H& N* L3 L/ Y B
7 n; |" a- T, _! @8 Y4 R+ M- e 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
/ G! a3 W) m2 ~: W# f$ m/ ^ 5 B! O& W f, x3 y$ @8 t8 `, k/ P! J
Options: % V- ~7 i' }; m; N: Z) `" @
2 N3 A5 `% r' s8 l, B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) \: B8 c" p; o6 ~ 3 B# Y3 Q3 Q& a0 J7 Z" y
不停的ping地方主机,直到你按下Control-C。 ( w7 r7 L+ N$ P
% F/ h9 z. U" a. w0 L
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 ~" x( m0 w0 i, y" O9 R3 I
4 `# |) _/ r( G1 A -a Resolve addresses to hostnames. 5 R- E. n$ R- ^* O* o
B- O$ t8 [( y8 ?5 H 解析计算机NetBios名。 - x0 Q/ n4 m, B: [/ l, p5 m0 O
& S" R" w. G d' t% z. j9 W 示例:C:\>ping -a 192.168.1.21 : E3 A% g4 z- l x n, F# |( f0 s9 C3 G
( H/ o" M2 H/ E' K7 R1 k Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
r9 E$ U+ w! Q2 e' F
5 {2 H# o# n$ N7 L7 ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 o6 A- l. T5 Y
% v! ~' {, p6 h! }' V. `. ?3 K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! {) Q; V7 c0 d* E # g8 [- L4 }' D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , y( A3 h" q- q* ^3 j9 e; F0 c1 v3 S8 r: S
/ [4 E: h& G0 _* Z* I
5 _8 X" u$ l. d, S9 Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% }6 o+ A5 i' l3 b& _5 P
, r8 a. W2 D; a# J8 S4 l Ping statistics for 192.168.1.21:
( @$ r2 {! y1 \5 r
7 z8 }# m' ^0 d' x3 i$ c( }, q Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 p4 p4 j4 l3 Z! h% C
2 c7 X' L8 j% c1 W
Minimum = 0ms, Maximum = 0ms, Average = 0ms ) E3 S5 Z/ p) Q: k/ ^
' z6 q; m" X) I
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* ~; ~1 k2 |+ u3 @9 I) T' P# N B: {/ N8 A5 q2 X
-n count Number of echo requests to send. : |) I) Z( |) e& T, I% ^
6 [6 O+ m6 |: ]8 i" D 发送count指定的Echo数据包数。 / `/ S- g0 a t
0 i: g) B- S" e+ ]( t; y2 Y$ L 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% X j& J5 }' r, Q( o 0 b) o3 Y6 X: D' B6 ]* J' T% U& W
C:\>ping -n 50 202.103.96.68
$ B5 P. G6 u8 @$ T% \
- r6 f) D) k x( F Pinging 202.103.96.68 with 32 bytes of data:
) y$ b- p6 o7 i4 }& B5 i5 O
* c% i p$ V8 O+ {6 v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . P4 i( S6 } c0 T. r( L
# e: ?0 D$ G6 n; Q( x& g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' O0 I" P7 ~& |
5 {* L, ]/ u0 D5 d( s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 n$ j# |7 X& A$ Z, T3 o" z
/ i% V/ |0 h1 l Request timed out. 6 [0 V) q' l5 g) @/ s5 a- ^4 k
4 e* j; G* K3 P, ` ………………
9 a+ s6 h/ C- X* s) O; G7 \
% r J( E4 n; d) H9 s( b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . n0 M p+ g4 ^4 `+ z- n z
) _6 C1 [) e [5 T! {, }3 V- A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 f& ?; P/ Q' r! l% R
$ w- E3 P7 c6 P9 Q- P! N ^
Ping statistics for 202.103.96.68: 8 _: E# z& _! ?8 N
' e( h- y/ X0 M; K) ~
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: $ I2 m# M8 B) G/ S+ Y2 ~
1 V6 n5 x0 b- F! M8 I Minimum = 40ms, Maximum = 51ms, Average = 46ms
9 d5 X' F4 h+ @# D5 ~& k . v; c) q: Y( k
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( Z9 r6 n" O8 E5 _4 Z$ _
9 m+ A: P- l: w" O$ Z, n
-l size Send buffer size. ! v5 e i# ?# c+ R/ S* ~* H
0 V( w( t: V; ], i, ]+ D* _ 定义echo数据包大小。 |
|