|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 E, d& l7 }$ w& n# q; |+ C
! e/ |6 x5 Y4 w n: \& d3 f 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 f4 V4 D5 ?' \ f) H3 _0 d9 [7 i
# y0 q/ W8 q, w6 g( }" [& B; j 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 G1 v1 g5 S& z3 G* i6 l3 f
' U1 E4 n6 S/ Z) [6 ]" u, K8 f0 x
Options:
9 }5 ?! d5 p; _ & z6 P* A; }6 U+ G" N& l3 P
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 \ {5 W( Y5 I* O
1 s' {' }9 z" m) ^
不停的ping地方主机,直到你按下Control-C。 ' Y" M+ u% p5 q: M2 X3 L* \% X
8 R* a L3 ?0 Y4 d$ O2 a3 A( ?3 Y, E$ w
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & r6 `! j0 D5 B' l5 m
8 E) M' s% T" Y+ t
-a Resolve addresses to hostnames.
" |3 `8 m" M+ m: V 7 s- i+ S4 o: z- V3 s! R
解析计算机NetBios名。 r1 d1 W+ i& I" E2 Z
. c, O- g) h O8 P: U$ `: k
示例:C:\>ping -a 192.168.1.21 . d3 A* b$ ~" j' }
- x3 i) p e7 p+ @
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- v( c/ }# L/ J y+ o
9 T+ d/ ^* V+ i/ a& t$ ]' A) c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: X1 L" G$ Q B- u; a) M
: G, y4 h1 h1 G8 i" z8 W Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 ?/ a2 Q' H5 d* B3 u" j1 r
/ v, Q# v. D2 ]3 Q9 O6 F6 q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- V, [1 i5 G! p8 k; B, ?2 }5 d; g; C+ s# e- c
' Q& c+ D: U6 Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( a* U0 N# m* u) x; c/ i7 s) ?" c $ _9 \- v6 f- b6 `; i4 M+ M2 c7 g. m
Ping statistics for 192.168.1.21: * ] R- u& J1 x8 Y7 x) {
+ D3 r; Y# W, a/ E$ h. |
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 K; n G3 `+ {' N: O; J' N) Q- v) | + g7 u, f9 z4 j$ B
Minimum = 0ms, Maximum = 0ms, Average = 0ms $ z- ^, R' M" d& u6 D$ V
) ~ g7 D+ U4 H1 i! d3 j3 K3 i. I* M 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # f4 b, I$ Q5 t4 Y/ p. s2 U0 ~
, ?0 Q' E8 W8 U9 V -n count Number of echo requests to send. 8 `/ J( X) J K1 r
) F6 \+ }8 E! q* {
发送count指定的Echo数据包数。
1 N; u+ a: m$ m
! L$ K/ x# i" T& s h. E' R 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 c8 N3 J: |5 R% |. M( ]
) f: |1 \; Z7 L( w0 y$ L5 j C:\>ping -n 50 202.103.96.68
: Y0 u- R& n6 {: n , l1 L0 I4 c) c' H
Pinging 202.103.96.68 with 32 bytes of data:
% ]5 n; w* A ~* B6 ] . E! @0 ] N* H0 v6 d6 C0 Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) }% T! u; Q- f, m2 o6 M
z% i1 n( |# m/ D) D) H+ f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 y( t2 } l) f. s; k5 ^- A
; @9 ~7 e3 F8 F* I1 [ f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 }4 h2 r- n8 s: M
$ P9 n8 X, c5 y. D6 ]
Request timed out. - t$ z- H; W/ b
& F% W7 x4 V2 R1 m ………………
/ N% `& ^ s7 J A2 }; t" j ! h+ w* J) G+ u4 C* K6 k- p3 c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + d9 v8 M4 C- a0 ]
: ~! H2 p. J8 R) y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 Z- ^, u, `! C" }& N \' C. d' E* S9 E- M1 @4 K" Y& ~- u
Ping statistics for 202.103.96.68: 2 [% o6 l3 L- }
/ {% ?- X, x* r
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: / p, ]! [ z% g' j
' P# b* A0 K- W) x( ? Minimum = 40ms, Maximum = 51ms, Average = 46ms / ]0 g: b, y- `
$ \- b+ m7 w, V% i6 V7 l3 P 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ! Z1 q. g z- \) @* j) U
3 d( s: A; e+ ?& @! @) ~' N
-l size Send buffer size.
. v) l! h/ w$ T9 m9 \ @/ z
" x' `4 j) w. w/ ]- P d 定义echo数据包大小。 |
|