  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
L; d3 o4 J0 u: y& p [% ?
2 i& m: g/ t0 }% i( J6 ?8 K. | c 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 6 I5 i9 C6 A4 `' ~$ N8 }; W, x
- n; n- `7 v5 s
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 & p( _* M3 X7 @5 G4 L* T- B: H
9 j; z( @. j9 T2 m4 Y0 c
Options: ' A2 j( T. O% x2 M
8 Q: @4 G5 ~, `* ^5 c- @) n
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
0 s: V. \5 f1 ~8 c8 U
/ R8 h3 X2 M, |. T 不停的ping地方主机,直到你按下Control-C。
" t/ b' t$ {' Y4 ~3 |: Z* T/ W
+ I8 r: m) A* F7 v1 L n& W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 Z- e# G; s& p1 [ , u2 j; q6 ], d! V
-a Resolve addresses to hostnames.
) j5 `6 T& O/ Q9 M$ o
7 ?9 r- i$ x( u8 i! D 解析计算机NetBios名。
' l+ Y9 L% v9 ^4 H6 x, `+ i + S2 V3 T4 i6 i# L7 n [
示例:C:\>ping -a 192.168.1.21 / q: A9 G7 A7 [! p; V# r
3 [! ^% y! Y. J2 `" g, } Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" s1 o& @. q0 i6 Z% s6 ~ * n9 {* `5 ?- q6 @2 d/ ^7 i0 X/ k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 D/ ?) w1 N3 ?
) `9 |' y, S* R8 V x8 C Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # ]7 G$ b# a: f0 q5 B# ]
! E, T8 o2 P) k+ j; I- p. e1 g3 O! O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% s( n+ c2 [- N9 R, a, q& s
) b, `* A# j2 v) ~6 N & l. }) J6 X0 \2 @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 w8 [- ^) y5 k, i- o) M9 ~ 6 Q& l( k/ L ]
Ping statistics for 192.168.1.21:
+ r3 m. E1 \5 S0 d& P Z6 E0 J
1 i p$ l" M/ j! C7 B% Q; ?2 I Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : f! \$ P% w9 F' n
2 b) i' `" a+ e6 K3 G6 {% r7 P
Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 Y3 V0 Z2 t# i+ d4 I& L
" m q/ z& M1 a4 m$ F j 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* c- i# M6 b, W, a% C1 \# k8 y ; G* t2 I, v7 k- H& a3 R% ]
-n count Number of echo requests to send.
( Y* H+ i- _( ] . u0 D0 f! X, W( v) I* @
发送count指定的Echo数据包数。 + S9 X$ v: k" n, Y5 b& p4 ]' l
, Z/ e, k! k7 T+ c3 I 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
5 ?9 Q8 r% Q* f, X6 {1 T( U- u ) J4 Y, `6 b$ N7 R
C:\>ping -n 50 202.103.96.68
! H% B( U- X& L7 O8 _: m* B! f" o
1 b: z" ]6 P. }$ A: X0 f Pinging 202.103.96.68 with 32 bytes of data:
; W$ N) B$ T3 ~, H : l, l7 f1 I* r* l3 ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ U: w9 b+ C8 d" i" h
2 ]8 a) J! s, N" w9 M$ `: { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! A# [9 w( E. |8 j- K
( K; q! m6 }9 y& ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( Q) H. h: O0 A
% K2 N; ~/ h6 f" F9 i Request timed out.
7 {1 F* C k5 \3 D) ]! G2 ?* o# @ 9 _' o7 d U' Y
………………
, `1 y0 [* J+ z# l$ \, Z7 M/ F 3 U3 Z7 i; t2 U+ v7 m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, I* F \- K8 W& a; R [
0 B1 O ^0 ^* d0 X7 `' I) o: [' w1 a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 F- h6 c x% ~5 v 2 _ B8 O. b/ o" }+ F3 H( ~
Ping statistics for 202.103.96.68:
) s, E# |$ K) H; Q- J) z; l
8 N( A1 p: Z. j+ K4 o- y1 V, d Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ! ]) q2 y' _" |* J
$ n7 N9 l8 }8 D1 _ Minimum = 40ms, Maximum = 51ms, Average = 46ms
! F2 v; d. _1 c9 L6 d
2 N+ W! o0 g' l 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 K) X8 s5 e( Z! D0 F5 g
3 M0 `' |4 w+ a' w& R: X. j2 o0 |
-l size Send buffer size. & u. v" q4 `" ]: f, n" w7 K
& h; |0 }9 Q2 Q$ A: I; }/ d 定义echo数据包大小。 |
|