  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 r1 s0 Y& }4 F, s% p
; L# @- f9 N3 Y7 `* { 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
+ q& C- {+ {5 M# t7 h, K) y
* W f" ]3 j1 y! t8 l/ E' k 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
/ @$ ~3 L0 p; T1 \! w8 b
1 P2 v, v" K2 P Options:
- H4 V. |! }2 W/ s) h6 E
2 ]8 I$ j& [, s U6 d1 v -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) Q- h2 J5 ?. p3 w$ a+ O3 N( M$ K
& k7 r$ [" R, v. }8 \7 V$ E g$ F 不停的ping地方主机,直到你按下Control-C。
, ~# m$ _" B$ u8 S& J; R j( o
# H( H9 x! m, ? 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
! }9 Z1 O, h/ O6 v8 \* c ' j% z N. N- M- t+ n0 r
-a Resolve addresses to hostnames. % H4 v/ E4 j0 x5 K' u
. d" [' F( |8 P5 @* z( N2 P2 n
解析计算机NetBios名。
, h/ Q4 z: q' a* z- G 4 T: P( {; a! m# H3 _" ^7 {( b
示例:C:\>ping -a 192.168.1.21 - s2 Y+ N( h( b0 ?8 h5 q. E
4 T, s: q) Y6 P5 j8 u
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * @6 R) s# d8 t6 b
5 i6 [" h% {4 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" X# f: o; p+ L
$ N# x( u S: c# [7 x Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % F" |7 |. f- R8 d9 s
, f- X# C' f8 G4 a1 Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, M( W5 V: {/ B/ Z! k$ A0 W* u
) y4 Q# |; m- U' D, |- L * ^, R( w8 X& q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 D: I5 _; k* l$ ]5 M1 l7 g$ Q
, J W& m- X7 g) E Ping statistics for 192.168.1.21:
( l) X5 I5 C F0 j( e0 Z( B * ~6 V$ w1 y' s( t/ P' P
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ W5 j3 ?" H8 Y" W( i w! n
: U% w: O. i% o1 B6 ]- J5 @1 w' P Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 K7 J( u& p3 P9 a) g. f& [4 @
( Y# n- A! q$ \, ~ _! _3 m- H
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 9 n2 H4 j7 q5 A+ Q3 k) `9 a
0 U& l* L- A m5 U7 y4 E4 l1 V5 o -n count Number of echo requests to send.
. P- Y: i# i: |. R' T( \
7 U- G, ^! i9 e& H1 J( ^ 发送count指定的Echo数据包数。
L' E2 L# c. J/ ^0 { 4 ^4 x" @8 s9 `7 |; a) L( v0 r
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
W& t5 A. U8 @- y2 h , p) K4 i( j1 W2 b: G5 T, _
C:\>ping -n 50 202.103.96.68
L2 t7 u8 q0 s+ ?( @8 ?) `$ v : ^2 S3 O& E. N0 r8 M% E; G+ O9 M
Pinging 202.103.96.68 with 32 bytes of data: ( t6 N3 ]5 ?; m2 p+ o
/ `& F3 U( Y$ [: c' S( u, z$ ~% f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: i' i1 m4 g& I ' Z P1 V8 C3 j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' w( k: }4 c/ G" z/ ~
3 `" E: S: x- k# D& C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 s2 V) M* v8 I5 t( ^
: [7 `, I7 N3 z; G5 x Request timed out.
4 {) @& O {+ a7 H8 I, H' V
) R6 C8 b7 t; k" P ……………… # |1 g" O& W" g
( Y( f) n, T( r" a1 { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + r+ i0 ~( A7 S$ Q- }- ?# U: u
' m) b7 X( o; @! J8 l" _6 H Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) j* m- o- R7 {% W) M: y- i* p" _" G
) R) A9 @! _4 j; B) F! ]# Q& o$ [
Ping statistics for 202.103.96.68:
7 `0 J8 G, l$ Z6 b
! ~; t4 B* _! J8 Q, u Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 t, X+ k# b; E6 P0 p* _ - t/ e' U9 ^2 f
Minimum = 40ms, Maximum = 51ms, Average = 46ms
$ E8 ~% _( {6 ~. u. s( _
/ [ f& @/ D0 i0 O: D' ` 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 {3 t# N5 r, j! }- ?( ?0 n* k
6 c( w- y+ ^" L3 v$ G, T& d7 p9 b5 h -l size Send buffer size.
4 c1 C- c% I7 B* Y+ i/ O0 d 2 t: [4 L: h! R1 w5 Z) R
定义echo数据包大小。 |
|