|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
# w/ Q5 F2 v9 [. c8 M
1 n O7 G. V" n- R6 ?% k, {/ {. P 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 a* i( @! L. f, b
& c/ x- e( `7 w0 p0 `" x6 g" c 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! U4 P1 s, Y9 E$ k
2 x: f' j( U3 ~ m6 M* [ @
Options: % ]5 U1 C/ u W) I. \
; h- b% f8 K. Z2 f) c0 A6 { -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
' Y2 r! ^: d' ~ c
% C) d* r1 }, w, K 不停的ping地方主机,直到你按下Control-C。
( A/ e2 @; q5 ]* a# Z $ k( Y) U; x4 H9 T
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 T1 B. Y+ Z' N% S9 r3 T7 Z3 k " @* G" G" y% o6 b; K
-a Resolve addresses to hostnames. * n$ o5 ~* }( i2 [2 L$ [# i
& q# V6 q0 A- Y5 R) D
解析计算机NetBios名。
0 r( ]1 C6 i) w0 o : {/ F! w; L5 N7 l3 h. O
示例:C:\>ping -a 192.168.1.21 & C4 D" Y. ]/ U4 t5 P; J
2 z2 _1 `- F% x5 p5 n' B
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 9 H# A& R$ M! m; r% ~$ Z4 F/ [
. c) P% a% \$ k+ F" j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 E$ \) {1 D$ X
/ O) n. n/ X* T6 S, Y- `9 o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # A& R( k5 H( i$ W
3 e/ b' C" L, U2 z) R% x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Z H+ q8 q: V7 K3 p( Q+ Z. S7 Q% s, B# Q# l q. N
U7 E. G; g; a0 k- D, ~6 _9 _$ Q2 x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 z5 V7 d( c) ~# X; V
# O0 M: u5 ]5 I1 r: v0 o; M- a d
Ping statistics for 192.168.1.21:
B% F3 i8 j- I( Y
. D$ j k6 W: G4 Y3 p! I Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 w3 F; r, } D
9 W* n g7 f+ T+ P
Minimum = 0ms, Maximum = 0ms, Average = 0ms
( K7 z p0 F6 u) ^& ~8 j8 N! k
3 ~- o$ d, n$ ] 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . Z. c) K- C4 j K4 ~+ Y- U
& f! ~' s! D& r* ?, j: [ -n count Number of echo requests to send. 1 d, U7 t0 k0 s) d4 M8 Q: |2 \) `: }7 F
" Y" l) w5 p8 J, S# N 发送count指定的Echo数据包数。
- x* E8 N; e. d
& r$ t) @9 w5 u0 p9 [ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 i. X/ X, G! ^7 P- t4 |8 w& V
5 Q/ J7 a, A- N1 h& K C:\>ping -n 50 202.103.96.68
% }) p v" P n+ U
) A3 J0 O2 Z. y2 z- p! d Pinging 202.103.96.68 with 32 bytes of data:
* W8 X! H5 \- L4 X ) h8 g1 Q5 u: B" k9 Q) c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 ?1 Y- u6 ^ I) V& @! [8 C
5 E$ o6 ]8 z% D5 s1 S9 h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' E8 h6 Y- g9 w8 O8 V' T5 q' O ) T p% x" g) p$ K3 p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 u+ j- _# i& B. V# q- G + x) w; m: H' B4 B. I
Request timed out.
$ t1 n) z$ `2 b4 i4 ~6 r
d' h; m* V/ B+ M( w/ x/ r ……………… ) ?( }! j5 ?9 E g
% U' U( Z2 b0 E
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % [6 T5 n+ E( R. a" ^- k
% z: @) m A" T3 K+ m7 I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 M6 ^$ |: r2 e5 a6 N0 e; Z# k
& Z6 I# a! O7 z. T X+ C
Ping statistics for 202.103.96.68: 3 T# r/ a. G7 t
) k* ?9 X8 Q8 G) n" y Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & Z M) \9 e* _' W2 I/ o! h0 f
1 {* Q9 W. g6 N9 F! l) w) [ Minimum = 40ms, Maximum = 51ms, Average = 46ms
" ]- z ]) F7 ?, P1 Y ; u- C2 k; c) s7 P, \" F
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ V7 C2 N3 O b) P$ Z+ s% m+ M
/ P) E: ^* X1 ? -l size Send buffer size. 4 T B! N5 w: x) z/ `! F: `6 \, k
; b2 d& }& C# ^$ k \( C# H 定义echo数据包大小。 |
|