|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 r; O( Q' L# x4 _. C
# j. T/ ~8 a6 x9 x+ `. d
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, ~7 ]9 |' `. x+ |2 g2 B * e# l* c [( Y9 p9 t! S7 |
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 2 i6 E) i" W% R/ J
! e( O3 o6 j* ]/ T Options: 4 F7 ^8 {. [( i) }( o4 L
7 v# R1 G7 B, v4 F
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
( y: G# r) A) j( x0 ^
2 y3 c0 X) n- I4 U& u2 [ 不停的ping地方主机,直到你按下Control-C。 " _3 }' S" H) X. ^% p6 p1 a. D4 t( r
1 b6 t% w0 {! |( Y 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
2 I' @* X. L) \; K0 }* E) J" i
, C- ]0 w7 J/ s1 I -a Resolve addresses to hostnames. & Z7 l2 ~8 _5 f9 A
- i+ K+ g. C- @+ c$ ^
解析计算机NetBios名。 9 L6 H, X, O" q, h* a
/ m( ^; V' j7 s: j# M- i
示例:C:\>ping -a 192.168.1.21 " ]+ ?% R2 | d" S8 i
% B& K; ?" H' C9 w) x5 J( n. L Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
: h/ }; L! {4 @2 |* y 4 X/ k- U7 J, t( r; I
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ x/ _, i) P) t# j9 e: R
! {9 e6 W& f, U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # [4 l" x8 p# g, u* j+ N
% f6 U1 L7 V! A( Q' Y( S/ g Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . m) [, B& c) [- K" h9 U% b
9 J6 e, U# d V5 R! y
6 h* J3 ]+ ^8 }+ q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- g# q' X9 A5 _- ], }% k$ e ( K9 g* w P' Q
Ping statistics for 192.168.1.21:
$ F! I6 t) l) \& h; t3 v) P5 A ' k5 _% p/ [. i! l7 m; D; \
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( X3 G4 l( a2 {/ v# N* n& ?7 U. P
& V8 _2 F3 q& F: R3 } Minimum = 0ms, Maximum = 0ms, Average = 0ms
' V0 G- W8 ]) W( m' E' c
& T! L |0 K4 \* ~ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ X& L7 f' }7 O5 C- }
) k. ~8 I1 M; Y) @
-n count Number of echo requests to send.
# q% I; y5 ~9 s" `, g2 H 4 O7 W4 Z2 m$ K1 `
发送count指定的Echo数据包数。
# H% d+ j2 E, `$ x! g! ~ * e `8 l1 u+ K4 D! m
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
' E+ Q2 u% M' e/ V V; W; G9 m* {
( h m7 ~1 P$ k7 s- g' B C:\>ping -n 50 202.103.96.68
, x, F( N7 v8 a: U/ ? ( c; o6 ^1 O# u
Pinging 202.103.96.68 with 32 bytes of data:
9 d/ c+ e9 t! F' b2 h/ ?8 U 9 _( x5 s1 Y# b: }. E
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 E9 q9 N( q R8 ^" r
2 }6 O+ F0 `4 o8 e) d- Y8 `; ~' K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
M' O8 ]% _) t( A2 w ! n |" N: a5 R2 P" L- Q: X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, m. C% T' B5 _4 L5 z T! ?$ K6 ? M! g& n3 h1 b; N
Request timed out. , ?. z& a8 V- U$ R. J8 v9 ?
: v7 E" B1 t! Q3 o$ F9 J* { W
………………
3 G( L7 N8 s x8 M# c6 D 4 B' T2 P1 ~1 d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 }& G" ~) O' g& g4 [- y' W
( S1 U5 L+ L8 {" P2 I4 |+ r! g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 K: q" ~6 z X5 {
- _ c: N. J7 o& y0 d0 I Ping statistics for 202.103.96.68:
1 d& ~% Y3 ^7 Z; k0 m3 |4 i * c4 f! u+ U1 `& N8 Z& M
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' }4 h8 G" `0 c$ ?
& _5 e/ U5 b' j @; Q# A$ L2 ]" {! k
Minimum = 40ms, Maximum = 51ms, Average = 46ms
. m3 Q: P$ i! ~3 b % d- r' R" Y9 Q' j; i4 x+ p
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
) K) j$ N/ }( H9 F& y2 T, a$ I9 h- e
% z y" _ }" p2 ]- n6 G/ C- G a -l size Send buffer size. 0 m6 _: D' G1 j: d# r8 Z
4 _; ?1 u& W; {3 N3 `
定义echo数据包大小。 |
|