|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 X. L5 X8 {% l. k
, N2 p* M0 w4 i5 E- s
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: / R" j# ^5 J" {, r! Q5 l4 H0 _: R
. g: i' o) h0 Q& 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 3 l+ r" }5 m, c; V3 o9 r( w
1 k0 [/ O( ?# y+ u Options: " @+ F/ Z) U& |! U% x
/ n4 z% I9 w, p2 Q
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 ~' d' [( l. @$ r- U" c' u3 l: i
F! P+ g& T* S; u
不停的ping地方主机,直到你按下Control-C。 * K9 E% M- {- I0 i9 A: L
/ @& Z; F6 a6 L7 J' g
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 d. O/ s) ^2 ]3 @( I
, E, \0 h) Q6 e" F: W -a Resolve addresses to hostnames.
# L' O" M% I2 a" z
- { F% N. c3 h5 ?5 X 解析计算机NetBios名。 9 m0 e- l# o4 z! Q6 O5 `. e0 I
* _* w$ i. {8 q+ I 示例:C:\>ping -a 192.168.1.21
( Z9 n* F5 Q5 M+ h" S
2 F9 ^! T' C4 \ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
( Z) D4 W" s1 L4 i$ C8 n( k
* u" `, _) |+ M- q6 a Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 f2 d4 X2 m7 c: ]& `) b
( r' `9 ^$ J4 l
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " K* Q( v: n: |; p+ @" r" z
( u6 D% @4 q- a7 L# x, X
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. U8 W5 G) n# ~+ d1 \" [5 q. K4 Z e% g% u8 y- q
3 o: B! H0 G' {7 @) v; n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : h/ c- E! c- @# r, v' q
, g6 \6 g6 Q" b2 y7 D% d$ V
Ping statistics for 192.168.1.21: ( l6 @8 Q$ Y! c
; ?" ^4 D, ^: f( B+ x. s
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
8 c" ^% b$ I( F! k0 a
) t( f# B3 t/ m( E+ | X; n Minimum = 0ms, Maximum = 0ms, Average = 0ms ! U: f5 Y4 r0 v1 L) G
" H; q% G; l i: U+ f! v
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! N2 A/ j1 t: ?6 s" k3 Q
* P3 @ {* V2 T- o- e; }0 c, y -n count Number of echo requests to send. ; I/ s3 H% k+ k9 A9 ?
$ y2 ~! C# c0 @4 O0 @1 f# z 发送count指定的Echo数据包数。 ) O+ x4 `9 x+ S
1 e3 p7 O3 {5 n
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 |6 k* [2 _( R; }4 ?& L u
- R3 T0 O+ X5 a8 S9 v2 P C:\>ping -n 50 202.103.96.68 ( [0 r7 ^1 s$ Z# y
7 a4 S! Y% c3 J Pinging 202.103.96.68 with 32 bytes of data: 4 a3 j! l8 p3 F1 R6 O
w3 l* _( r1 H$ m* }' ?0 L7 i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 ]3 c- o# B+ J. G
2 B4 T2 `5 o% K1 ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" ~" O/ W+ l1 O; Y- Z- i: W
# E7 p3 r" ], J8 L7 \' r, E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ Z- g0 |5 X; k2 ~% ~ . x: ?) g& l4 f
Request timed out.
- O; f) e8 x5 ]5 s6 p2 h; U! y& a 5 M/ r8 I% c0 Z
………………
8 c/ v6 t; g* n) Q
, F" v9 C( G) a9 D/ | Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, s0 x% s9 p, n; m Z) X! R
, o/ b5 g+ l% A9 b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& \ u/ C$ n0 v
+ ^: `/ W0 k1 m* `0 ^$ i8 { Ping statistics for 202.103.96.68: 6 L0 u8 h2 [3 k( `% ]$ [$ e
6 [6 E( n5 p4 R5 S/ h9 a# V
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ B4 W2 K% a/ u8 Q: w- O: ? , S8 X* J# \- d% K( S' V) Y- m
Minimum = 40ms, Maximum = 51ms, Average = 46ms + w7 M% ]; K1 I2 z5 c- r( o* g ?4 T
) ]4 v) B. O, \
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 . g0 ?; Q8 H& D- U% j! ~, S% n* o
Q3 V- m" `+ E2 P5 m -l size Send buffer size.
# g; q/ o0 W. u3 P & V( ?8 }( l) Q
定义echo数据包大小。 |
|