|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 m& w, v* d9 J) V 0 y" }: ^1 h4 K6 j4 ]2 W
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
! M* r1 j/ J6 T" X9 T
$ F! Y3 @1 D' D+ F. | 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 0 ^% K" |& S/ [
9 q2 J) C, H1 N# Y' ?: l% i' }/ Y
Options: ' {- K. n A" F
! a- R7 u8 M4 G$ y& E -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - Q4 Z# h: Y+ y- V
+ T' j9 u8 }# n
不停的ping地方主机,直到你按下Control-C。 ' @! V* G' T) M: ]$ b
6 H+ p& E6 u0 L6 } 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 " ?9 @- m3 q% L @. m& t
9 G/ P1 L# f3 b
-a Resolve addresses to hostnames. 1 p6 r* t8 x! D4 t2 l7 @3 e
: C A7 R+ O) A; G% B# [% f! q6 j
解析计算机NetBios名。
5 M( [: Q* M" y4 {$ L
3 }" H! g& M9 Q' v 示例:C:\>ping -a 192.168.1.21
" i; c# c* V8 J3 O' X7 _
: f z r( M) z Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
$ n7 S6 h0 C( c: ]' s+ e$ q- A
0 v/ g* I% P, j7 S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 L$ u/ _( _* L& s0 m( |
, c! k6 f7 s# n% M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' w/ H7 s5 E2 U. Q* a4 p
' C( Y0 X: J6 \5 W$ V1 _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- q0 S+ b. M7 M& Z5 e- M/ L @) ?( e4 f& N/ V
( z3 w$ E7 B8 C% H& D9 v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 Y0 ^, F; l4 |" a
, B. \0 i7 b0 O/ l+ K
Ping statistics for 192.168.1.21:
9 z' j4 K2 {$ ^3 Y+ q
7 n* Z/ q% s- G3 g+ { Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
: {8 [0 d' i9 Z! i4 Y7 J
0 H1 O7 E8 D4 A7 \5 M Minimum = 0ms, Maximum = 0ms, Average = 0ms - F$ k: O* J: x5 s
- E: x0 S7 U! U7 L' W1 k
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& n2 F& R. _1 C# c# T % N+ G. N( n/ S! q& K
-n count Number of echo requests to send.
5 I! X& Y. N6 |' R1 P
( w3 d8 m4 U' ] 发送count指定的Echo数据包数。 ! S" N6 {3 e+ t; O" z
; h( g" F; B9 E
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
' @1 N! W7 n% [, K x 9 _' M9 E1 R% I" W8 I
C:\>ping -n 50 202.103.96.68 9 C0 I2 U+ s0 n. D7 \; m6 u8 G4 e
' s: M) Z/ e4 `0 S } Pinging 202.103.96.68 with 32 bytes of data: 7 ~6 p+ \$ h. q
3 p/ ~( l i: e" T$ H5 L ~0 G8 Z5 Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# z! W" f4 E& C% f9 R* k& E9 ]! } 4 ^2 O8 q, P/ G$ M+ q2 Y+ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 g* C: D; A4 {: [* b- M % r3 Q$ Q! |3 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ E9 Y) j5 {3 ?4 ]
2 s( K/ f: O4 W& ~: p Request timed out. ; j1 ^) D0 y* Q% d7 t2 c/ B& y! C! w
: |! u8 y+ z" ~! B ………………
9 l6 U3 K$ J5 W" Q, L0 u
1 Z6 W# K# ^8 r% }. W2 T; } Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" ~* l1 [2 c% W* s6 i , h% z6 W# s7 l/ B: r' W) j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 C- {; Q- R$ b7 g' R3 q, S1 s! I
( V, k5 p; Q5 T- v) d Ping statistics for 202.103.96.68:
0 \, _9 R0 y# S& U; ]5 h0 h( `
# \8 \. u5 s, R. g0 M5 r& Y/ D1 f Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 t/ {. u2 x$ q
5 {) Y! l1 r* N Minimum = 40ms, Maximum = 51ms, Average = 46ms 1 ~* a1 t; i, M- @$ O* S0 w1 C
2 p7 C3 y; T, U4 }+ s5 x
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ [9 j5 x+ Y* v7 `: { ; ^, K. C" f) n+ y
-l size Send buffer size.
h* D0 M8 i" h3 j4 q . Z2 [ c2 Q) z' u& t- A
定义echo数据包大小。 |
|