|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
: C+ Z4 I, C1 a5 x' ~& p " e7 E! ?9 q; g' R7 }- n! P
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 F3 k% S. q b
2 K+ I1 D8 U0 U1 [1 `% { 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
9 y6 }/ P$ D( O6 m G: p- j
& U0 S* A& Q) W. s# U1 a Options:
3 D% L; a* r/ D3 N$ `( e " [1 q1 m) d+ s" n8 w4 f" `- b
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. s4 k% W$ ~% l. S; B. Y 4 e& _) C, ?8 T3 O
不停的ping地方主机,直到你按下Control-C。 * [% T2 Q& A: z! p0 m1 ~
6 ~( B% W+ l5 c, ]+ G2 |9 F
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
; d* E: s4 e4 |' C9 J% O: Y % w4 d. \6 M7 p, |- a9 c
-a Resolve addresses to hostnames.
, X( y3 Y2 j2 {2 f1 Y+ f- q
/ Q; `4 g+ r. d+ M 解析计算机NetBios名。 % c8 u! r3 _! E/ Q' S& u4 |
' Y7 T1 @7 t5 E5 U" s1 \! r 示例:C:\>ping -a 192.168.1.21
# L# }0 Y1 J3 U" h
& k0 y4 d1 Y, ~' s: n: _ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * E0 Y# _ ]7 r
; j% a; u8 d# S" G7 G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 z/ M7 A+ \" Y3 d" ?, f* T , B; j: R1 m$ `1 D7 U; O1 o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : s: d- t$ _# i8 i
8 h) e, O [5 G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . M4 {5 K# g3 ]4 A* ~& [
9 q \& F `2 F# E/ J* X4 o$ e% X6 ^ 4 R9 E2 p0 @% R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 g) R- W9 ^# ~. l
& Z2 M/ h2 c* k- I( ~
Ping statistics for 192.168.1.21:
6 F3 I' O* M9 r6 m/ { 4 u$ Z8 N) G9 @: p
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
A9 S1 [7 j( ] , |4 {5 W) m' {& B- p
Minimum = 0ms, Maximum = 0ms, Average = 0ms
7 T# o( _. @9 i- L
/ ~: e# K# ~& S+ x% | 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 g/ g* \2 Q! o3 [0 [# y# q
! g6 z( [' O, `4 x$ ?& g
-n count Number of echo requests to send. ( D ~/ A0 t% l- T
' s3 v) I* B- U% [: r8 c 发送count指定的Echo数据包数。 ; P: M& O x4 D) e8 X H
- G5 y1 ~9 A0 h& e: _% c0 l/ ` 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 d9 M$ o5 v( \& F& g& q# C% C
) t* a6 B2 X; q! @6 L C:\>ping -n 50 202.103.96.68
$ \+ U# ~& P6 M" l! Q % e; R$ }4 P- M8 m! Z9 F
Pinging 202.103.96.68 with 32 bytes of data:
9 r4 r; M; a" S. k+ w/ b, e 2 s3 J4 h8 k4 S' j7 o) f0 }& I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 v, G6 A/ v+ ^. F9 G! ~: N
" O5 `. Y$ W. p) Q2 f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 s a4 K1 O- T& O% k/ _- l
+ W1 W U6 p) W/ ~3 T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 X+ m& b: r: w, \' W# S1 v - o" w; U/ d$ B& C# }, }4 b
Request timed out. / T$ b2 `5 k N/ Y4 A5 S
% e: a: e! u- w1 v7 j( Z4 ~
……………… 7 Z; g3 R3 p9 n% p: ^. m3 v
" G: Z; G3 P7 Y+ C+ [; l: y/ D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " y1 d* G$ o7 w1 y( |" h
. E7 I }5 p( ?+ V! l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; x4 u6 K& @' H o7 M& q! E 1 ~ i2 a; [ o( ~7 O5 e' _
Ping statistics for 202.103.96.68: 7 t% r, k' X0 T i$ i! f
/ L( [& V1 S# l" K, r
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
7 ? r3 J; l: T7 I* G( g ! j7 j: i8 o3 J! F
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 P% A' {+ I1 W5 V7 @4 Y9 d / X$ m) R, r) Q
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( O, V) J) I+ p
4 i# t' e/ h( a0 P, u# {. W, G -l size Send buffer size.
9 p5 A+ x' O7 S, l! \- \ S7 P( z3 G, I3 X$ U6 K; x4 |
定义echo数据包大小。 |
|