|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % R: Y) f A j; N5 P0 F) i' j
3 n. D% [! j1 h# r
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 h$ m! s( l$ x' U' j" b) z
' F7 L# S5 o& `/ J6 }% Y4 ^9 _ 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 ! E& t2 J% R, B+ i( H$ }3 y
1 z3 Q8 Y4 F% n/ @
Options:
7 N5 e" [$ y3 {" R" k( M' N ) ^% T$ e5 B) {' v9 J8 D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 j% m5 H/ z( r7 a5 A
; W& A* F! d5 m 不停的ping地方主机,直到你按下Control-C。
" h$ P+ D! V8 o7 [( d3 k * P8 x5 E. U( D! S0 P, S
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# Q# G3 P0 s8 S8 } 9 B$ a8 V1 u+ n% `
-a Resolve addresses to hostnames.
% s0 D, H( P* ], ^6 Z* @6 f
5 u, B3 b* t# T1 |2 f/ p: V' Z 解析计算机NetBios名。 7 O4 C0 g% v1 }/ M7 {) o5 w" Q
! r- A7 O% f# u
示例:C:\>ping -a 192.168.1.21
0 L- p. K4 q3 Y9 ~7 q1 k: q
; B) I4 w5 G: w+ n; J Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
8 D8 ^0 D# G7 M+ [" P) i5 U, s* I " q, ?3 `, @# a$ p, a
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' A# v- `% c0 n+ \4 Q3 r" w
C* @. f U! a( `3 F
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* N3 H: X/ a1 |8 `# [+ H ' k% F6 D3 c& V* J% x( N7 t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( D! b; m* z2 d/ U8 L
) i5 O7 q' J3 }. w" w+ C2 \* C
5 y/ g! r+ q6 |: u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - D6 K, U0 n6 B3 u8 Y
K) }4 X7 c: q- `" c- B' h! L
Ping statistics for 192.168.1.21: ( r* P) r7 C* G- a* B
; I' ^% D; T. f5 Y( ? Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : m+ P3 V. Q' B* g3 ^- q4 P
, e: G, b7 A q* ~, H0 Y+ E4 X& ~
Minimum = 0ms, Maximum = 0ms, Average = 0ms " n0 ^ H0 y% ^6 |; a- G$ E
! r! N/ C; h- F+ Z- a: ?6 [ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 4 Q2 u" w7 W/ s
" `9 |5 V0 c. a3 A t6 [ -n count Number of echo requests to send.
% ~# I2 G6 N2 i E8 ~- L9 H 3 M: m) `0 g; |8 W; s9 \
发送count指定的Echo数据包数。 ! Y5 C" X; m- r+ K9 w# b: L
) Y5 S0 e! V, \/ P7 F
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( W7 g _9 g7 w! D
2 R& h' ` E" D) ?: B. J8 d$ w
C:\>ping -n 50 202.103.96.68 2 L5 ?! _" \( j, ~* L) v4 m
! A) O- ^% T o: k* h
Pinging 202.103.96.68 with 32 bytes of data:
/ e8 z- m) p; `
$ r1 c8 c; U7 K1 X, W6 [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( l5 U x; [: S1 }- Q) N
9 l. }1 o3 Y e* l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 o* l; R& J: o3 F& `' O
/ Q" y5 C$ x1 k& n$ R+ o% x4 }) Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 N M& g7 j8 H# g
, k! G9 e+ c; z4 d/ [, t5 F Request timed out. : l1 l' U+ r+ x( [1 { L
/ y g) Z3 L9 V" O, r
……………… 8 x7 u8 F$ t5 G+ ^
3 z8 X3 h I7 n2 s9 f; B Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + I5 I! t/ s# |0 z& G; u$ C, |5 K2 c
3 h0 R4 @1 h6 r6 z7 Z, R- c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % n: t% M$ T* j
9 t& n7 y9 z- g& v* B& ?4 F/ S, h: K
Ping statistics for 202.103.96.68:
& [( s. Y3 t3 J+ ?4 H, |0 G! S ) f. X; {- O8 x' ^ I2 Z
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: o" _" B: ?! x& j: n& T/ ]
! j6 z. v6 J0 _# d' J' A. g
Minimum = 40ms, Maximum = 51ms, Average = 46ms
+ H; n, d5 o/ ^
# i4 k7 r r, I/ y- d( W% c 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : R F/ V$ b# o4 I$ Z0 M7 m
5 K4 T0 E1 b D0 |
-l size Send buffer size.
. Y$ l1 l1 |+ A0 A) J( c# M
G2 q' a7 Q9 z# L 定义echo数据包大小。 |
|