|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 0 s' Z! D% r" N' x$ K1 U4 ~
- L2 Y' V; x, @" O3 n5 n8 L 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 2 Z* S4 X a' C/ `6 v, b- I3 r# l6 G$ H
6 }" t8 O0 s7 q" U( d7 r 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 ' m3 p6 {: e& Y. w
- S, j" e. Z1 T' N
Options:
/ W! `/ ~2 Y8 P- I5 x% k; y7 [: J4 b6 X+ S # ~- T! _. P" q( B* a
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
! ^: }7 i+ }9 H% H8 s
, \- q9 ]2 Q! ]7 _4 U 不停的ping地方主机,直到你按下Control-C。 ! m: z6 ]1 A9 z Z' M; r0 n
- y9 o- R A+ Q C. J' o! q( L) p ^ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ! Y7 E) J3 m6 j( K7 m2 v- C" i
7 K5 t3 B/ n' X% o$ r -a Resolve addresses to hostnames. # F3 u4 @6 ], l
& V \- j6 K( C$ m1 N2 M- \1 T$ X6 M 解析计算机NetBios名。
0 h' Z) ^- D5 a; B. {4 B7 \4 D 8 G3 A. h* J' l" V/ ?2 @, l1 u
示例:C:\>ping -a 192.168.1.21
' |0 o# a/ b8 |; D! u+ M2 |
) w s0 c! ?0 ?9 `8 u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % I. E- n& a5 @- o8 R/ W5 H
. ` T2 Z# z8 q0 f6 U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& a% M5 R! L: E( {' x
0 b1 o8 F; [5 J9 F5 @. O$ K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 V* q8 D* q, z6 L- |* y, f
# G+ A+ l- F! N: p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 t% M1 ~6 {1 c! W) u. e
9 o' i" K. m B0 n" h# E9 s( s* \
9 O8 o: F0 [2 R/ Q8 B8 X6 ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 {3 B* @# G ]" @4 S: v
7 @7 q( b5 D2 N6 b6 d Ping statistics for 192.168.1.21:
% [$ |5 E3 L; G: d1 j
/ c# t: B9 q1 ?' b0 ]- X4 m Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 s' g* b; _0 Q0 F l) k3 U5 t* I3 Y8 [; T
Minimum = 0ms, Maximum = 0ms, Average = 0ms
% U7 R6 u8 F6 y7 s 2 G; V& v* H2 N6 v
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * O- h+ D" ^6 X: S Z. u
O: ~% \, T( ]) D3 A; n -n count Number of echo requests to send. 5 ?/ Z; |1 X/ }. }
/ x6 K) ?9 _3 T3 v 发送count指定的Echo数据包数。
9 w y/ U0 N( e6 x( @ z # Q2 ?/ R% n) W; I$ x4 c: h1 x
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; M- Z0 l) t% p9 T2 }1 p& |
3 ]( p: Y5 r, s% ] C:\>ping -n 50 202.103.96.68 - q9 `; S2 s/ k: D; @! n
( b/ o7 u) e5 I& }* R v! y4 Q
Pinging 202.103.96.68 with 32 bytes of data:
5 M4 K% f, W4 u4 `
! U3 q7 i. h& r/ v" j& i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & Y5 y) e" _- e H: T% i2 E: c9 x
* s5 \" {' l: V+ ^- J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; [: b% s2 \. w$ h5 d$ N4 e
8 N: D+ H9 j, k3 Y! `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 t5 Q& ]9 D* E( x
& i [5 J/ m' B* d* x' D Request timed out. ! e" m+ a `0 E& `' u4 `( x
- _& z- M3 F& G4 z* @; `$ A5 ? ………………
6 h3 k9 f" t: x: ^) j: L
% k( r6 ^9 S5 g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 B% Y9 J6 O4 j
; T p$ w( y1 M& ], Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* v3 M% ?! \: k# T6 T+ n! [
/ F! G4 V6 l! n8 Z5 U6 d Ping statistics for 202.103.96.68:
' x9 k7 C9 Z* W* m& k$ O4 \
0 n$ M' N: |9 d! e+ r0 N0 @) C! C Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
M* ?3 y7 U6 r- W b$ M B. f8 w$ H& i2 D, Y, _
Minimum = 40ms, Maximum = 51ms, Average = 46ms
$ Q2 _; O8 U( A3 v! q : G0 D) T. g: J n" ^3 u9 u
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : b2 J. v# B3 ~ A3 |
1 e' @2 q1 H5 R& x' y( b. e
-l size Send buffer size. L( c1 Y" K+ H% Y( v! h! W
0 w4 q0 N) g0 t& b8 D# | 定义echo数据包大小。 |
|