|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
8 k+ u% S: E- u; `) [# @4 A - w2 ?% `( d: f5 L% ^" L
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) d8 T( k) M4 F1 i ) G3 i# B3 u3 J( O
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
5 D. z1 v8 B$ M) k& l0 y# D 7 H: {' s/ b2 i
Options:
7 I. p( a( W; { H
. \* s {) X) R7 F- l1 l0 ^ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 8 @+ {# @2 z# o3 Z3 t
4 S& ?' K% \ x& `. U2 _
不停的ping地方主机,直到你按下Control-C。 + l n) }6 x8 j8 C9 N/ t
0 p- L. y7 L/ r$ t: Z. I+ Q 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 + {% a3 f4 M. l" @; o1 s- O
; E0 F4 c: D8 i6 N
-a Resolve addresses to hostnames.
* Z4 z+ I# E, i( j7 |# _
' q' s2 A+ D) l9 f9 V9 e, l 解析计算机NetBios名。
; x. X$ i) H+ P! K7 [. } : c8 Q* R; P* W/ ~, g
示例:C:\>ping -a 192.168.1.21
) d( p9 i Q& R3 R+ q , p! p/ Y9 e# D% {6 Y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( {( @5 F7 [3 v8 {, @6 z
. }* C9 |. {' z9 a% V4 @5 S F9 p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * y1 Q U. }+ @
' I |) m( a9 @, o ~0 E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 q( t; T, l% g. }4 o+ t6 a
* J: {- S/ K$ S% M9 { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 N( o+ ~* f7 D
0 [% y9 I8 z$ c5 u; h3 z . g9 S. q- I% n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : p& s; t( T/ C: J. N% ]
5 Q8 `7 @6 ^% c) @; j4 h Ping statistics for 192.168.1.21: ; @, d% G/ L& Q0 O
% w" G" y9 H! U3 v3 J/ @, m Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , e0 N8 R( B' S( A5 W
5 S3 _* ~ w& a
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- h* X: }5 R" w$ c7 b% X. j
$ W0 t# D: |( X- h( q2 r0 y' K 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 , b2 F4 W5 C5 i- g) A6 }
1 B3 b# @$ ~. q1 f) g
-n count Number of echo requests to send.
3 X p- N! o {0 ]& d ; I2 l$ j8 c( q
发送count指定的Echo数据包数。 5 [% i0 ^+ O5 O0 b0 ?
2 C1 r4 l, r- W2 ?* R
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 2 F" U. F2 S6 I, s7 k% v( T
: Z; h( D5 z7 Y( l C:\>ping -n 50 202.103.96.68
0 W* r/ e7 {! C# W9 B" T% k
6 m5 z6 k! {& F* m: I( N Pinging 202.103.96.68 with 32 bytes of data: - X; Y Y$ {7 \ V# {8 x
) m5 w" r7 G5 p" x/ Q% O9 ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; I2 }, _6 G% O$ W4 `
6 T# ~* ?# w- O$ a2 U# P$ ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 ]( v t3 |$ l( s; \2 D
* e* G. v6 Z5 ]$ Q7 |- T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: f- O" U$ T" c
+ W6 _5 s& M5 B9 {" A Request timed out. ' B" ]- {. v- I
1 b& @9 e$ z7 w: U: w, ? ………………
9 x1 Q; ~ @7 T* A , z1 v- m9 m7 H" H: e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 a1 M% P E3 E- F& |0 G
/ w8 a8 \4 F6 |/ y4 v2 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; D4 l/ @" }6 I# P; @
. O; y. J h5 P Ping statistics for 202.103.96.68:
* {& r0 d9 F9 H2 s% N% `( q
4 \: a, @1 ^, c& c6 { y) a' W Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
) `1 l' C9 U( y0 _( E7 e6 D
1 H8 H( m9 Z! P( } Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 C. N; Y, f0 l7 q% q8 C" n: M
- s1 v* R" X$ R; T0 m% I. \ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 _5 h8 L& \" @6 y9 ]* e
/ t' Q; q/ Z( H -l size Send buffer size.
) P2 L( I( t) W+ k% J+ _7 r6 Y ! y, Q% y; z/ h6 O: w
定义echo数据包大小。 |
|