|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # u% I" ?: @: h/ ~ J6 U5 L6 e2 p+ O1 [
( A8 D( H5 R2 r# ~ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& \- M. p( x/ C* C5 Y( } ~
) n6 Y* S) \: A7 `( N; 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
( z0 L# S% i3 Y+ e
% r% X5 ~- T' x4 l0 P( g0 x" R Options: - ?( T* v4 [0 [) U7 p) J
; C( b6 y1 b, E! T. F2 F2 G3 ^8 w -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) ?3 i# `9 [3 z8 n a
( b; J# i8 w7 U* A 不停的ping地方主机,直到你按下Control-C。 4 L. j: [* @1 |- h, N5 @
+ ]- l& p& N+ |" M7 ^4 ^+ d* O 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
- y! M* W/ a3 A3 R% F/ l
& m4 y' x& L( L -a Resolve addresses to hostnames.
3 H& l# J7 G, A3 P4 F# l
8 |1 P2 @ a- @6 G- r& H% b- \ 解析计算机NetBios名。
% P$ o+ ^3 [; X$ c* V/ C
( Q) X( g/ K( I9 `0 ] 示例:C:\>ping -a 192.168.1.21 8 t2 Q0 y% s* G* `
% o) X P8 X, s; }1 L1 c" g
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 `6 p" \* d$ n6 p/ z4 r
3 _& A& u' f( }7 \' o" g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( b+ X ~9 a/ V% |3 E: U8 j
3 t6 w. p1 v! [& ~* d I: h9 { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & _& n& P* f8 i7 h
6 x0 l. o: M( v2 ?) T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ T; F o4 c* R4 ]2 J# F* j4 B# p7 h) l! U0 e
9 `% G+ v3 `. P B& S* Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- _; O; D+ l0 C5 `- W0 v! G1 n . a: @* K( _, N; v v8 J9 H3 d
Ping statistics for 192.168.1.21: ) U. M6 U! F) S, k' O+ R
$ |: w7 y2 x- o, A
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: - ?: I6 G* M) v3 D- {$ Q
4 B2 p, w6 X8 c( N* O
Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 H$ U+ J2 f: \3 s
! J8 P4 u/ y7 R+ l A0 ^) s9 C9 x 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
' L$ n9 o ]# r: T3 P; L
0 p/ p. j' W6 A# Y/ k( R; c -n count Number of echo requests to send.
6 s; G4 a) f) t! W3 J/ R% u9 b. [ 0 K( X+ i1 e; H" a
发送count指定的Echo数据包数。 + @3 m" U& B5 I, E V
1 [( P9 J# v; ?2 N/ R+ z" u2 N
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; } ?: m" L! u
( C! y5 G* u) c1 f( s& ]: h" ?
C:\>ping -n 50 202.103.96.68
$ s( ]; e0 ]) q: Y" v7 b0 n( _& V
: y: n5 ^# F$ v! g Pinging 202.103.96.68 with 32 bytes of data: : J( G" i f Y
9 X' I. b" f- K, _9 x' `7 Q0 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - I7 N- k' `& M
% ?( U2 m8 {' q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ X% z- d& I( e- p6 ?9 d5 x , z8 a- C! s% v; V* s. r% L' i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; ]# z2 B9 A; w" d5 U
% _7 r9 R" U7 u+ j. P# M; r Request timed out. 9 l( p& U6 m5 g+ r" k; N2 y6 i% ]( ^
, M/ I4 B2 Q- w8 s+ z& { ……………… : Y! x1 s) p: {
- X( X: H4 L. N8 i" @& x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 d5 y! o' |" g4 {0 z
5 e5 G% |7 j' Y) Y9 P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! `: w+ T$ w% r4 _" D+ k
6 f B. V7 S4 B8 e$ q Ping statistics for 202.103.96.68:
% |* `& S7 X( E4 o5 U% o
& {4 {! t4 Z$ _ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
( C" l: Y% c! o, w
/ c1 l' I4 f* c9 o Minimum = 40ms, Maximum = 51ms, Average = 46ms . f- }& Q2 n" W! c0 v
/ W' v/ ?2 P! `. B 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& J, c$ b( }* U3 b , }3 m8 M0 x* x9 I% T- d
-l size Send buffer size.
, z5 n6 g3 S8 m) J3 W8 Y
+ |" W3 U! H: {) r" m V 定义echo数据包大小。 |
|