|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 / S0 {/ a- w! Q) s
v7 s$ b8 Q" s; U
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
5 j( B- q: _4 |. z2 q3 f8 _+ e
* m* J& F% Z$ A A* @5 H8 t 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 ' s# P D/ v1 E3 \
7 u1 U" ^2 [+ n' C
Options: / x2 X1 s* A5 { w: m8 b0 P& P g A
! I- {3 j# `8 g/ | -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 2 y8 g( z" o1 B
2 `+ I2 Z. `0 ^) }
不停的ping地方主机,直到你按下Control-C。
5 Y7 T2 R& f) _% s8 [' U) N
5 o: x7 l& _. p5 ~: {7 ?( r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
* v' S5 t2 w+ K$ p! f, N; ^; {' j % {4 g* Q7 ?; k8 l5 J; r
-a Resolve addresses to hostnames.
6 T/ b; g; b4 @9 a 3 o& U2 W* j G; S4 n, Y. s
解析计算机NetBios名。 ; D1 X T# @+ A
8 i: v& W6 }% w! b9 { 示例:C:\>ping -a 192.168.1.21
5 z/ M3 A5 D: G/ T8 Z6 r; z) B( K* f 5 O0 A& }& \/ d0 B# k, e b7 [
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% u6 M: E: t2 b* ?3 p 3 }* Y* \8 }8 J2 U- s8 p
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 x: M4 K" L; w$ O. ]3 M
0 {$ v( C8 `+ R0 Q# N Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( k- [/ \2 {1 P z9 N; C & r4 v8 E* o/ N" b5 \6 O2 ~) f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( S/ h$ b) c5 P7 Q3 P% f% u
+ O; @) k( v) S, f
& a! P* I( ?7 u. ]( s2 i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# L" t& j* h, L( W0 l ) Z8 F* a" X; p1 V
Ping statistics for 192.168.1.21:
' `7 {+ @( `: c/ J9 I( y( \
! ^" X5 m. I* M& R1 P: x4 A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + ?2 i3 {6 F; q+ l' n; r; }0 q. J5 U
8 C. d% x2 H z! @ Minimum = 0ms, Maximum = 0ms, Average = 0ms
q8 Q* p- `* x) h/ O* U2 c+ h- C % d/ h. _/ u' }- ]
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 & C6 q, u% e6 O
" L2 U6 m8 J; @9 g" }
-n count Number of echo requests to send. - J1 Y" ^5 z; P
4 @- J: g5 a; [; ~/ w o( U. ] 发送count指定的Echo数据包数。 " n7 K2 b/ C/ [0 ~
! I' T& h% k( Z# e, d! p 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' a: v0 a i/ j1 ]6 }+ y; Z# t$ |
' f5 |2 A' \8 m4 X9 M
C:\>ping -n 50 202.103.96.68 2 s: A2 b( j1 ?% u6 W' y
5 H8 T9 l E% g8 E7 W$ _# J Pinging 202.103.96.68 with 32 bytes of data: 8 c* G6 l: p; U, H
0 V" R. \* _) m" [8 J, L, D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 P+ c( i5 u; A) I6 {& x5 S, ? . `$ M- o* A8 Z) n. X3 W# j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 N7 g# {2 k2 `; z8 n
2 M$ P2 c, b7 H4 d( \1 y4 L
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: G% J2 G' R6 F" L- U3 y. e J b
; I0 F1 t, F1 [7 ?' T2 C* _ Request timed out. - F- j" C5 S; Y
* j- M0 |+ w$ z+ k3 _( a% @ ………………
* _, D7 R8 ]% O8 K* \) ?( { : V5 C& l% u8 U& V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " k+ R* c1 p. U8 \8 w4 E1 I1 n
% S, k/ B) {+ X% ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ R6 ~' @4 K( x8 ~/ j
4 X2 w1 [ o P% s Ping statistics for 202.103.96.68: & i( b( U1 V2 Y$ L2 ^4 j3 o0 g
9 @6 U, T- T' q4 Z& ? Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: s+ O3 S; v: u( k% G. k
7 L/ r, M0 X4 p: H- a% L. K' c
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 ^ E7 C2 h0 i2 L# t4 B+ h4 Q ' m& s& p* ?9 N% e) J+ a
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 . @3 S) ^# L/ v# G/ |0 ]: j
: [% X& V' w9 r
-l size Send buffer size.
7 U( q4 j3 k5 \1 m: g3 u 1 K+ ~" ~ I3 |3 Z: {' Z
定义echo数据包大小。 |
|