|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 / q1 M7 J; Z; ^: n
3 k$ r4 w! \/ Z( f5 y! Q& R, A: o 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
3 R8 ?( U4 [* r4 S1 \ , t7 K& `1 c. a
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 % u2 f2 R& O4 y5 z" _/ i0 N# K
9 M) E/ p; M# |: P
Options:
7 l' H. g# m' _; k- o: W0 j
" j- n. U9 q6 }6 j1 X -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / B/ L8 c! |: n$ k* V
. \5 V0 T* D0 T+ Q" [7 q; h
不停的ping地方主机,直到你按下Control-C。 # N1 G# T0 l5 n# \2 Z
2 A6 r* G* L+ P
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. L- g+ {3 \$ g/ t" f- u
) J! q5 S' C6 v$ y# f2 q -a Resolve addresses to hostnames. ; x- E( e) n% m( g, w
' O; r) n! L4 q1 K0 j8 w1 @6 s 解析计算机NetBios名。
9 S. h4 S" M6 g7 w$ A3 a+ U& c- p 8 t5 g- D9 p3 x2 y2 j) L$ z9 U0 I
示例:C:\>ping -a 192.168.1.21 4 `. f2 @& o- c' Y9 D( z
* b& }1 r& G1 x) X. s& B5 w, s/ p
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: - m9 d; o8 q2 b8 e r* q" [5 ?! Y
) U1 G. e* t0 V! f* x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
L) S5 _$ ?4 e: P# A* h 3 h8 Y# s) b1 a( q( f/ `/ |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % X4 Z g/ I1 T: W( _4 d3 E/ Y0 ~+ a
5 p% s$ u+ M" \% w8 M: [7 O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ N- p. H( E4 L. u8 V! Q
+ W- ~' m% P" j; L7 G
" ~3 w- p" R+ N/ g- v' V) b% ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 D# N# d' d3 S# ~8 b) R6 H
' ^2 F2 V V3 ^' p5 `0 F Ping statistics for 192.168.1.21: : z, A+ u: x: o8 ^7 n
5 {7 Q8 i; g, |
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( l Q' b6 a6 }& m* S0 Z' r
2 q% v9 S) @* @2 ~/ Q Minimum = 0ms, Maximum = 0ms, Average = 0ms
% H0 y; ~% @- ]; e ) M8 x9 e; V: _% e. }" d3 T+ x- L9 ?
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
h6 a1 S8 o9 @# O7 ?5 W , ^. O9 \5 G1 ?3 w2 l
-n count Number of echo requests to send.
7 k, L& C/ ]4 E4 A- \9 m4 V5 h
( G4 Q( j/ B' z3 H4 M+ K/ T 发送count指定的Echo数据包数。
! @# ]8 s0 y. l1 Y/ L) U
) {% i$ D2 z- r4 T5 j! y1 Z$ Y 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
4 g. g# Y) e$ ]! x1 Q. W
2 m+ a; s. f( j1 \) @9 W3 z C:\>ping -n 50 202.103.96.68 / Q3 I+ X- x6 X" G
# V8 U2 b, s, D6 V
Pinging 202.103.96.68 with 32 bytes of data:
6 @7 t3 [' F9 l+ q, G" | * m1 k( C1 R, L1 c/ [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 ]" M! K' X8 T3 {( z& `4 D
+ }; _: `8 C5 z. [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: [' \: |$ v- ]1 @( v & J. n' @3 [+ T8 J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: e o* |# H* L. D) h
6 ?5 c1 H9 p3 E; V; }% @' y Request timed out.
+ H0 w% D6 G8 ~) z4 @ # c3 n0 R; w. `; H0 C" T- O ~
……………… 2 f, f. y# M" W7 Z, F
5 P: h/ J. d% c) ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / q* B8 P( i; y+ a; G5 T
9 a0 v, l Z6 |: w4 ?9 s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ e. N9 d" u) M+ ?7 v1 w* t% ^3 S + I# k& d0 X* m/ `6 O/ Z: h6 G
Ping statistics for 202.103.96.68: 1 t1 ]! y+ ?; `8 `3 [$ ?8 L
2 ~3 t- Y8 R' I Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" u1 y, c) v+ ?8 a* q9 I$ |" Z 3 n7 S* I1 }# G* Y7 J- I- @& ^* p* l
Minimum = 40ms, Maximum = 51ms, Average = 46ms
# n0 z) q( @$ J$ `, t! Y) m3 f ' B! G6 Q3 r9 K
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" q8 }' M3 a3 P2 W& ~8 q1 R
* R* W! ]5 e5 o+ i8 U& ?' Q -l size Send buffer size.
E ^4 s& X3 ?, ^4 N! a3 B
( I8 z+ m3 c( S9 B1 E B 定义echo数据包大小。 |
|