|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 / t# Q, s" r/ K% Y
/ d- U `/ t. c" R8 W; Y# ~ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 2 n+ i- ?# q9 A7 y6 |+ e
- i! }6 |( F" G( R; j1 t
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 I2 j# P$ `2 z: J; `9 P
1 a v1 r9 K2 J Options:
: M. S! e" @; h 3 s+ l7 r$ r) \9 C0 i1 v
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) f5 `) A' ]3 T
* Q) I. H* q: ?, x+ X 不停的ping地方主机,直到你按下Control-C。 5 o( }) h; G" J0 V
8 U D5 f3 e7 K; p1 d I 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
2 Q! `1 I& R. e # Z3 |1 |- K: t2 u
-a Resolve addresses to hostnames.
$ }! S7 X+ u; I% a- C2 m- C
& v" a$ G7 O- } 解析计算机NetBios名。
% x) R& N. q8 K H7 X/ ?9 @+ B
4 Z4 o# u+ F/ T; j8 I 示例:C:\>ping -a 192.168.1.21
. m& J+ P! } P6 q$ @
' y/ a0 s# N0 y5 ~ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
+ Z: ]1 l" o" b: Y0 F4 E! t2 Y" j
( D2 Q4 S9 b$ ^8 {) r! D) ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 ], X4 U& ]! p. [1 p% V7 ]
/ |; O0 {4 C: i2 L& ?# W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 [7 Z' _; V( ]$ n7 L
, U$ U- \2 f# s) k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 D6 T) Q2 D4 R, m! q3 i% ]
0 x2 I5 Z5 X9 q/ o" @8 F8 M0 ?
! r+ {. x. Q" R7 L. e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 V, f; t6 V Z' d7 W$ H1 O$ A
, \1 M$ s) E! d* p5 h- H8 b% E+ i Ping statistics for 192.168.1.21: 5 b: C; U4 s8 }3 p9 G) ~& Q
! ~9 x! d4 Q' w W' L6 I4 J
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 I) W; N6 b5 V& Y. m
W1 `4 V- z& {; ? Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 P x O9 s& {" N+ |
# o) m- V: o- ^7 ^+ v6 z8 H6 Y
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& c$ v( d) q' R) u
2 g }$ i- M9 s6 y' p( F -n count Number of echo requests to send.
. p* V5 [+ _ R \; j3 w, o - N) O: d- x9 u1 m* I+ v
发送count指定的Echo数据包数。 0 _; l$ c- X/ S
; Q% y. g3 D* V, I0 ^ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
# D9 A, ]* M8 x5 X; [, F
5 h7 K% J( i% D1 D: M C:\>ping -n 50 202.103.96.68
9 |7 ^9 J ^4 G) o! V. o4 M9 [ 2 e+ z; U4 k. C- E3 C5 _
Pinging 202.103.96.68 with 32 bytes of data:
" n0 O" Y1 i9 n& F; ] ; M2 ~+ e0 |- c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) j9 R ]( B. T
- B! L8 [+ N2 J I9 u* e) ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- n1 T* M. G" C8 d. b }. P% c ) ~! \- ^1 j# {/ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! q4 }/ E; }) S, Z) E3 [, T1 l
$ e' [" [0 S( C# \$ w: { Request timed out.
9 X7 D5 y% M: r: n5 b1 V2 b& V- d / b& F% D; K2 E2 J' }( o! q
………………
- V# ^- z9 H( ^( F& F% T5 X% \8 a
" p" C8 L+ i8 S Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" v8 v" v% o7 e! K* o 4 R- w% V5 ?) e ~9 J/ U4 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 ]$ q0 {& E; O 7 V# b" x: e( ?& x5 x3 O' O7 Z# @
Ping statistics for 202.103.96.68: 2 @+ c: Y8 j7 ~, o/ r- G$ q, h+ z2 p
3 V2 B, a0 C; Q+ E [' V Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
, k( k9 H. f9 K; X3 \5 e6 O
6 n) C3 B5 E W; ~$ p* m c Minimum = 40ms, Maximum = 51ms, Average = 46ms
% t# K# o: m4 r: h: g $ O5 L5 N5 g2 j# l; }
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 % B/ r0 J, \: x; c" K$ A* y! H! P5 q
2 M6 s* |/ C( w4 T; o
-l size Send buffer size.
: W. u& l1 X- j* _5 d- J ' {- B# z" c# B- q/ Q/ z
定义echo数据包大小。 |
|