  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
' J5 l: U8 Z- R3 x: d0 o% G0 b) |
2 f" s3 ^8 }9 T6 [) |7 r 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( q+ y _$ T5 J; c9 i 7 p& F2 g* U) y1 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
k9 E2 K% o8 U5 F, a ) a& Q7 `/ X! C8 `1 v+ X2 v
Options:
& R, U0 ]# v% V. Z c. r7 X 6 I' a& D# j% j! Q9 L
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ; c" v6 x: }5 \5 `9 H5 b+ c. S |
1 N- f( }. _& X3 j
不停的ping地方主机,直到你按下Control-C。 6 A9 U7 M$ [; e1 i7 D2 r
9 m" f! j4 W. S2 U# v2 U( ?7 h }
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 $ o/ A9 c7 \9 j
: ^' E$ r8 Q4 Z% G3 } -a Resolve addresses to hostnames.
' b- N! R5 y4 B! B4 d' f " V; ?( m% ?" c7 w- J+ W
解析计算机NetBios名。
* P2 R* g. S1 ^. a0 o* [ 1 W8 w4 o/ Y+ ?9 _
示例:C:\>ping -a 192.168.1.21 % f' Z0 G2 Q* a) V5 Y
2 ?# l- A8 n4 c$ H! O# }" [/ r. q- m Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
/ U' B0 v8 y0 j! ?! \ . T$ h8 H; Z6 o: a$ O* \. |7 V0 p5 `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( F5 a/ P. F& q J. x! o
: H) t! ^8 _" K0 J& r$ S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! _* q7 G+ [7 d* h7 o" q( ?& i/ p
+ c! ^8 V7 V" U$ P; t9 \ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & r5 s5 P7 u! p% f& J4 O) V
) J9 f2 h8 m7 [8 \ - o- L/ }; W/ N* e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - l/ O- d! ^$ c. _7 m5 G) E
R& ~" a: V: K8 t9 e
Ping statistics for 192.168.1.21: ( G4 t, T- C" \+ x) K Y# B
0 K% L) M, u4 I% O3 Y4 Y' @* ?
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: y0 n+ R1 V! U+ M
5 n+ Q0 u4 s: G" d. Q
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- C. S7 [7 s' T" Q' W2 M 9 |# |! p# n( g4 X4 A
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ e! }5 R( `4 t+ s' f E% c
1 }2 K& ]( M; }, j( k( j9 B -n count Number of echo requests to send. ( p4 {8 k+ l1 ^8 r1 M! g
/ c4 T" D2 h- j, ^' l1 x* k
发送count指定的Echo数据包数。 ; p0 W& B) E0 k0 t
Z/ v3 Z6 d$ |9 k4 u5 X c( f
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 S- b& G6 p$ F, W
& h8 `' V/ v* [: M) q C:\>ping -n 50 202.103.96.68
, ?/ N) t+ l8 Z* {' m f: C . W" ?" j7 D, b; s) V, {7 C
Pinging 202.103.96.68 with 32 bytes of data: ; l0 j3 ~! Q; t: l9 y
: A+ }$ ^0 V( d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- u! i# L9 ?3 ?7 r2 b N ' e0 m; j9 W, o/ D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 q- _' {7 a9 d2 ?2 a ' F$ U) W, e& X: f/ ~9 k/ @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( [9 I3 P2 I; D) {% O) {' v" F ~! Z8 S
9 n2 N6 _& P; {* H0 V0 v; v9 m* W
Request timed out. 8 `, j, W' i8 Y0 L1 t
' [' O; }- H: t ………………
5 z+ O! I/ N7 v0 Q, o9 ]7 O% ? I( A$ g - G# }6 c+ s; u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, q% i7 n. R+ ^0 h0 x' P( | * u2 y' |7 u4 Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 L8 L8 G% Z) M 7 Z6 S8 z" ~9 M" h6 J/ |8 l# d! p
Ping statistics for 202.103.96.68:
4 f# N% f) D5 M* v! W
* U4 k" t9 t; B! l% p& M Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% X! S, X; m7 B6 i( I
& f( }7 \; J6 I- f Minimum = 40ms, Maximum = 51ms, Average = 46ms * Y, D: [' D2 n& e, n/ F$ w. z5 D
+ r5 R3 p4 `9 o; W z 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, n3 i0 L; m; w 3 b4 Y4 V, d' u" t( F0 d0 C
-l size Send buffer size. * \# t+ H, r3 Q9 Q: b* e
; ~: O1 ]0 i+ P% F 定义echo数据包大小。 |
|