  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
" w i% j' F; C k$ E ; ^6 r1 ^& F, {) R {, }
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: , X1 I& b6 X2 g
1 s# _$ n6 T& @( H9 U 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 + g5 P& _4 x g8 m
" o" Z. \; `3 r# H Options: * w3 j# J0 H3 l) z9 T1 B# \7 y+ L
* m7 y l# K4 n h; ^# }6 i -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
* X% C# \+ \3 h 5 Q; c" q% h7 r. ]- m! J8 h9 K
不停的ping地方主机,直到你按下Control-C。 8 M8 c5 o* ]+ J
- \2 X- C; P' H' Q; h" ^ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * R6 N# l. ]5 n, f
h& S: c! z" K* h. X( T -a Resolve addresses to hostnames. 5 m" D4 a" g4 A8 u" Q$ o
! ?2 A- |2 P L 解析计算机NetBios名。
j [& H# C* ~" J
' s& ]9 J- F1 |9 k4 c: W; F 示例:C:\>ping -a 192.168.1.21 / y! B) W& d& [# L8 r
9 S' h0 _: u4 ` B0 j Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- |& @ o7 W; {
# B- \* W8 W; `7 ]' h) e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 T& b% N/ t7 Q. G6 V
4 V7 J( ^& ^. y3 q3 ^" e5 e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 J& I# h [, \* j
. ^) @* v: w3 Q, B7 I. }7 B5 g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 W0 a1 y! `9 S' B; L; q7 ^8 u5 c2 J( Z& U; K
# }7 U p- p9 N! N1 n( e% W Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! O* _- R1 t4 x f! s4 M
& J9 y8 ?& ]4 I& N6 f0 T
Ping statistics for 192.168.1.21: ' e! u5 y/ P' V% @' v1 Y* d
9 u x* u/ b4 R- _$ Q: c
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: " f8 b: A1 w4 b+ p7 `# C' @9 O: l! f
* C* V+ Y; \) l M0 I& l Minimum = 0ms, Maximum = 0ms, Average = 0ms 0 Q& t& i; {2 C. f- U" W
5 A8 m8 [* ]1 I3 k% T7 b" J' ~
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
" H( M& E# G- X' G & G3 Y% u7 m" {9 c/ S. z
-n count Number of echo requests to send. $ N2 c6 U+ H6 ~ h1 s
# z" X7 z$ d. r2 y: C& I
发送count指定的Echo数据包数。 + \2 |1 K1 c1 M3 y6 m6 i0 c
* V G- A5 i6 M9 s' r 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 7 \4 Y* @7 \( z
. _) h! P2 F) e" Z C:\>ping -n 50 202.103.96.68 7 H {% g v+ o$ K2 e1 q+ R# L" T
9 R- b4 @2 Y# m9 E
Pinging 202.103.96.68 with 32 bytes of data: ; j- V+ x `( [& r
1 T- Q7 V; H X# v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ l9 O( M6 M. }+ @0 z* s6 o8 p( S
6 @1 v* a9 p0 {( A& N$ H" x+ \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 t" h3 ^2 J7 ~* f
7 W! m5 R; R' Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # [2 w( `) I7 _ e. K+ `4 L
% E0 O8 X4 s% Q Request timed out.
: x. O$ {$ y Y
, l& E* ]4 Y' Y# R/ r ……………… ) }8 }4 b/ a( J
% H) @7 |# [$ h2 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : s* L R a9 L7 Z; o; {; |; c
! b" Q5 N1 M# h" i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, k' z- D, J; |$ \3 U
6 e7 ^; B9 G. v: S3 Q( e- ` Ping statistics for 202.103.96.68: B$ G/ w8 G3 L; ^' F) E
. R# Z6 K- G [6 B6 a; f- [ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ; f" y# V' S+ W% X/ c; x
* v4 h( A5 G9 Q Minimum = 40ms, Maximum = 51ms, Average = 46ms
4 h/ w: }/ x7 ~9 w 2 y9 R$ Q6 w; @1 @/ y' O; S& B
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 F2 [& F m# h. p
+ a4 s& k' ]6 D+ z- p8 I0 | -l size Send buffer size. 3 }$ k& y% x; J# i" Z2 P4 Q
6 L/ ?% L8 _- a' n% t, o3 C
定义echo数据包大小。 |
|