|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
8 h5 l; D* D9 G/ U7 N+ X# G- g ( |! Z. v/ T" B! [' I
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 V) Q) G& e$ q& D! x* w
. T2 D7 _& `. o7 U$ N8 F2 Y8 k 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 / b1 s. P# M' T, t5 p V+ S1 p* v
3 ?$ A8 z9 y. x4 M' i+ k) i" D
Options:
; s: j6 d+ C0 @4 y7 ?0 j# r
0 ?) d/ o5 x5 a1 D* @! J, U -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 _: Q# e$ m+ l, X6 N7 ^, [. a( w, x1 s
5 u& W* [# O4 b9 m" v
不停的ping地方主机,直到你按下Control-C。 7 E( E5 [: U+ U1 D7 ^; s
% ~# ?" O! H2 r8 J) b 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# j& s5 H% I5 u0 M+ n+ G ! c* p. U% f0 ?6 f# f @$ Z
-a Resolve addresses to hostnames.
; o' W& ]: D3 N+ Q
. C8 G2 r! c5 Q- l3 b7 I. F 解析计算机NetBios名。
9 ]4 \+ y# e/ Q& K % k$ B H5 Z% I# m- }; B1 B
示例:C:\>ping -a 192.168.1.21
$ k/ i% }: V, z0 v7 b1 t" L 8 P) Y8 j. ?4 N9 B2 K) S7 k$ m* b0 k
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 g5 X! Q5 ?& k* y1 e
2 U- h, o5 W+ y* a; x( ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) i: t7 X; ?7 j- g
, ` N! |1 C9 P6 a. E g( ]1 V+ R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 h! N9 }$ g. V7 }. n
( `3 |% t) ~4 M, x6 ~4 ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 T% S6 T+ W1 \9 Y/ q6 |- @3 l; |% u. J2 b! |' j
0 C3 l# P. `& Z$ M. s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 x; V% b/ r2 Y% V
4 U) b* S% k3 ]* x' I# r- P
Ping statistics for 192.168.1.21: ' Y) y) d. k$ D' S/ y% u! W* _
1 t% }' r- E+ N8 T8 _ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: & l: _8 q4 C9 E8 ]8 H. c
$ y9 f2 x# K/ n. `( W, E Minimum = 0ms, Maximum = 0ms, Average = 0ms : o0 U1 h9 k! u6 O
# X) F% @) T, b& x) T- `- F 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
1 Y$ ?4 l/ y8 ]1 V2 U1 I - w5 O& |4 r: \' c& X5 i
-n count Number of echo requests to send. . ^9 M- w: Y u! F& d# {" e+ `
. D6 n+ s4 O% u/ x9 J& z 发送count指定的Echo数据包数。 ( m4 u) ?) a( B. P7 Z
6 ^# R5 ?! [( m/ G d/ ]
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% }; [5 J$ b2 ?! P W5 L2 S " y& U- j; |4 L# D9 k" j
C:\>ping -n 50 202.103.96.68 " i3 D) m0 Z5 E# B3 `, g8 T
6 n6 a! r' Z; d6 @6 A% @0 g
Pinging 202.103.96.68 with 32 bytes of data: 0 \# {& v( O& f" M+ E
, A2 N0 {. u+ n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * b6 {* o! o# u* p! v8 S6 s
" i3 Q! z" [' K7 V6 Q+ U- _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) c2 Y+ X g% k4 V / S/ @! L6 Q* a/ q5 b* o
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # S( z; a* G b( b( p. m/ w
$ s6 @$ x2 G7 ^6 |3 I Request timed out.
5 K5 M. W! K1 p; @ " C" Q8 ]0 M8 b( J0 r
………………
* g, i5 I5 z9 U3 y3 r+ r' ~ 8 g' }6 F# [5 l8 d4 J9 c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 p1 q! U" h3 T( |0 ]& N+ v# c ' P4 ^; H1 ?! h& {$ N/ P" J i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 d- T9 |5 O; ^- b$ I
$ t5 e9 o6 v* c- r Ping statistics for 202.103.96.68: 0 c: J Z& m; q* h
; u- O0 N, m' J% V Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , P( o! ?; g% B: Y% u8 i3 o' ^
6 _' n; {! B! B% a7 h Minimum = 40ms, Maximum = 51ms, Average = 46ms
+ W5 Y0 L# ~- d
+ O& R. ?- T* j( ` 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
. E/ K9 Q6 t3 B" ^2 D0 ^( L ! h7 n6 C* @) I# M. b* X
-l size Send buffer size.
% i' ^, m8 n3 F& v% c 8 S3 G; A0 X5 C8 I6 v
定义echo数据包大小。 |
|