|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 B! f& \' v2 p7 r
2 O! b* `8 J4 E, b; N 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: - [1 ]2 P) g- x* ]# W" f: U
3 Y: C3 @4 B" z# i/ A5 |7 y 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 6 Q+ P/ P+ X1 \4 ^! K& u) v ~
- J9 f ?+ v+ s Options:
; c3 W" F3 E6 k6 l
. Q: N* w+ ^; U; V3 l -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- F. y T2 z+ [% x ; c7 X7 R! O4 n
不停的ping地方主机,直到你按下Control-C。 ( p9 E+ i7 v' S/ H: ?
0 @2 l x5 E/ M6 x' Y* l
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 y; o+ J& N% @5 E5 y- y# m! F ; M0 J3 H1 K& ^7 a0 x
-a Resolve addresses to hostnames.
& x. g E$ w0 p1 N6 [0 ?% q / Z' P7 `% P6 N. C+ G0 J
解析计算机NetBios名。
$ I% \' ]8 N4 d! ?; Z6 q
% g' y+ a- s' Q$ h 示例:C:\>ping -a 192.168.1.21
% X* k! d2 g3 t* R9 j _# d. N; C4 Y: v
2 _1 ~1 g- W/ S1 ]( { Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- _; n; O" }9 ~' g( G
9 ~4 K1 j0 I! }. I9 s7 } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 d5 ^7 f$ s& v* i t
# W, J7 H" R! Q2 u8 y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & Z& b$ _( r, ~
3 W- t, V& l6 V" G( |! k/ L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 v: p9 C. d( h- u, _9 _
0 E% Z9 [8 S8 L8 q4 G # z4 w" ], l) ?4 l$ ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 {4 _. l* |: W+ \- A$ g; x# d, O6 n
# r. f' }0 O2 ]3 y' S4 o Ping statistics for 192.168.1.21:
1 j8 L. x! W/ y& L9 |+ m0 Y( v # i+ `' `" N: k2 m
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 e9 z! B |: Y( {0 r
4 W7 h3 d2 n3 X$ m0 u
Minimum = 0ms, Maximum = 0ms, Average = 0ms
4 ]: h- @3 g, l$ e
( t6 [: R" c$ G4 V! q. W 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
- A) S# m. v+ M4 p
! g! ^% x3 a ^. P% V2 I -n count Number of echo requests to send.
7 T, K/ l2 q& x- }
, w2 _& M$ V8 U0 _0 ]( }9 t. B 发送count指定的Echo数据包数。
]8 w6 G0 D4 k3 G
$ q4 W( q4 F8 y7 U5 h( O+ P 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
1 Q( g) u& I0 @+ N ( t) I `5 o$ d+ w: ]0 |6 r5 J5 a
C:\>ping -n 50 202.103.96.68
# C/ z; D8 x8 q/ ?
4 q5 H/ E' }, S; | Pinging 202.103.96.68 with 32 bytes of data: 6 ]5 F( s+ Z( G
( Q2 j$ y1 k$ u- n$ @% c& I& k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; @9 B. `0 z+ O- ?- A. ]0 m5 @
0 Z. U! `1 B9 Y7 B
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 h- t$ g$ D, z" I ' g8 ^7 H0 D9 ~% b( t" ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ d* ]/ }( H! E) F
# A' Z, [( t- r* {; }; U
Request timed out.
" T' k4 T8 Y2 O, C: |2 o 7 M" E5 B7 m1 ^5 l; Q- w9 C
………………
8 L r; _2 I+ U3 O. D5 Z; y! X0 d
7 p* z: z. M! B7 E% s- H: \+ k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' q- Z# w8 q, e3 U! }
- |- Y) ^/ } {' r$ s% C( ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 o' `: I+ Z' g, l
& J3 p+ @& c' [6 [. x% I Ping statistics for 202.103.96.68: 9 G) l+ _' U0 D: D) w' S0 Y5 ^
2 D) b- W1 q$ M Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. C1 b& t! x8 _! [- L; s7 ]- j
) |( T4 K0 N9 {* W$ _9 m2 T$ @ Minimum = 40ms, Maximum = 51ms, Average = 46ms 3 ], O0 T0 C4 G( U! [ B& B
( S1 a( y& A/ Q8 s, K$ A
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
7 W, k( C. k6 P" Q1 M5 @ 8 |/ ]6 E: V0 f0 C# m
-l size Send buffer size.
1 c1 a4 a& y7 Q
9 D6 D* ^& a* ?/ i7 k" Y 定义echo数据包大小。 |
|