|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
! \. P+ X8 n3 |4 o- W+ {
" g* _" U+ n2 W3 w' x 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
! V6 ~) Y& x. }: d
/ W A; @& k2 C" `4 k' b- b2 V 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
" w! J7 w1 E E9 ?6 A# x4 Q( C
$ o7 q- j% q! r7 R9 h5 v r2 f- c Options:
# q2 s1 w+ ~5 P+ U 4 n( L- d& a- i4 G5 e: s7 u+ `/ r
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. & Z9 G z6 ?* X
& C! s" X: A6 ]2 w7 f/ }* f 不停的ping地方主机,直到你按下Control-C。
, O6 p. Q6 y) x
/ y" t2 y/ q: c2 V' C 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
% y' S! ~) l4 `! |; [- S5 } 4 e& y* G5 z3 Y# V X, V
-a Resolve addresses to hostnames. ; K& s) |2 I5 o5 f6 D
) X4 A$ C6 ` T8 X$ z. x 解析计算机NetBios名。
7 l- T+ M5 W1 c4 P6 | |
, L" G3 {5 |* E' t 示例:C:\>ping -a 192.168.1.21
3 Z# k: t8 ^) A( Z6 R3 D( j
9 S+ j) ^( L( n% R) r2 U) h. D Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: + V K- f& g$ g
" q5 Q- H$ {% Y/ D( ~2 s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
N' Q7 H6 ~5 U' G7 R$ | 0 z7 w }* O D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* G# Q* z {1 { 2 ^! p- E. n9 @. k6 r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 }5 [$ m4 h; p+ ^
0 \( j0 {) N1 V" N V A
. f/ H# L, H( c9 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; N6 S% o- `! q5 D z" v 0 s; `4 T& h: C* V4 o! V
Ping statistics for 192.168.1.21:
3 J* N8 V7 G( v% _# w4 \. ~8 o 2 V9 V5 b1 f* H4 R0 l
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # w$ }% O( f7 e& Q+ F/ W
) X2 L N3 p% Y. \' c& _6 k
Minimum = 0ms, Maximum = 0ms, Average = 0ms - V5 Z$ }7 z2 M% j4 {6 g4 @
6 }- d# y% b. d
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! X0 c8 @1 s, I1 N 2 [$ n6 S1 L2 q2 g
-n count Number of echo requests to send. ' d6 N7 p! J1 ]( _
/ B5 Q& [5 U; Q: F 发送count指定的Echo数据包数。 ) S* }1 j" M* Q3 C! F9 O0 E+ M C
8 N# A1 I Q/ I
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: / }5 y5 `2 {4 u3 N! F
5 Q6 _6 R7 h _( G- d
C:\>ping -n 50 202.103.96.68
- P+ L6 L( b+ l8 @; |/ ?- y
2 q! C3 E! R( u% P8 j( D Pinging 202.103.96.68 with 32 bytes of data: 1 _* P8 R. Q0 `4 q+ @8 q
6 \3 B* k4 @& _) d' a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: ?) I* l9 b! P- r7 e $ {) z6 N) T/ H Y' K
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 C+ k ]" W7 N
2 q7 b6 z. D6 o8 R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ x7 D% V0 [2 F0 `9 ] ) R$ S0 {+ j9 }+ S9 v, n( U5 Z
Request timed out. : K2 T% V5 d' l
- s! ~ P% \ ?
………………
- T4 Y9 g, p2 \( c4 } ) o2 j' D+ B, s3 r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# p6 x. C, N: z" |7 j
% m7 {+ i1 c8 h. U Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; m+ }9 y- Z; _. F4 l
# @. i, i) ?+ Y4 W- W) s" |( H Ping statistics for 202.103.96.68: $ G% ~- \ {9 z( |, @; @
! J1 k$ \2 H( L: D9 r: s/ d Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
# {! ]8 m6 a! Y: v! M/ V* G ' r5 r/ u5 K% ?, H7 {
Minimum = 40ms, Maximum = 51ms, Average = 46ms 9 Y1 v5 ~% E1 M7 C# n7 p
, g! `) z1 I! ~8 z2 q0 i
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 t; [+ E3 D* U) G
" Q% E% P$ F8 k% ^ -l size Send buffer size. ( g9 X5 D* k m9 T7 L/ r
0 Z/ n: P" V. T; k* n5 h, f% \
定义echo数据包大小。 |
|