|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 l# q; Z9 G4 v' J0 W$ j
8 P. z9 e+ M+ l2 M4 I 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. _( }7 j r7 y6 r& r
1 E& q8 H$ N. n5 _ 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
+ e) X4 H( X. c Q2 S& U' g
9 ~6 W- N* q( E U& N" C Options:
( D5 T! t' I* V& A ! q$ ^1 T; J3 o& M
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 W' ^2 N# a- a. i9 _- v0 g 4 F/ i+ i; Q' m( R
不停的ping地方主机,直到你按下Control-C。 ! ?/ C; t- f5 N. [
6 s+ q! w) d. ^, h' z6 D 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 X* ~& I1 x( q- g# ^
, K; B# U N3 r4 v, t4 F
-a Resolve addresses to hostnames.
% d, f: w& \. s0 q4 u ( M6 c4 H( y4 Q2 Q3 C2 A6 j
解析计算机NetBios名。 }) f. d8 N' z6 e; Q
' i$ e* C# v2 r! t4 r 示例:C:\>ping -a 192.168.1.21 6 a" J, O' E W% y9 t/ F
9 V7 N3 P0 d1 @1 p! g6 K3 H
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" X5 T2 E. x- M* u% j - Q- m) v0 _ `1 Z |! G2 ^: @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- P" l3 k3 M+ Q5 ~
- t6 R- i$ ]5 Q) q4 ?5 l' u. w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * }- ]! o8 q- m# m
- l8 k3 ^- l8 J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + ?1 @8 Z2 c5 P: F4 ]
, }9 p& f0 ?7 I( H3 @
6 R+ S2 u# I3 p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
W; c& ]2 y; t# @$ P
" O/ a' H/ J" ~1 [ Ping statistics for 192.168.1.21: : C) f1 K9 n/ S! a
: G/ l* n3 r# }
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
. V& I4 h$ |' w) U) i+ x 7 L- b2 ]2 I& r b* ]
Minimum = 0ms, Maximum = 0ms, Average = 0ms . N* t: f. l9 N1 s# i+ {9 r2 N
4 E! A2 @- B: b4 W
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* |" G" a8 M0 V5 z
7 |; P1 c# V1 i) m1 h9 G -n count Number of echo requests to send. 4 V6 ?& r# @' L: j3 p3 s
: J7 {6 g6 Y) n2 n, [1 w+ b
发送count指定的Echo数据包数。
# ?0 T) U" M5 \$ u 1 N1 j+ d: C8 e. y4 L2 Y1 I$ p
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 2 C" ^; v! b0 C" {+ f
) P) {0 i7 C* E1 p* T. m2 l C:\>ping -n 50 202.103.96.68 ) J% Z' Z4 d, f9 t
+ e e4 O5 b0 O9 z* b Pinging 202.103.96.68 with 32 bytes of data:
6 k: j9 n. V3 x0 p. [" d
( @5 Y7 e: @6 n B8 @ ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ }5 ?$ w2 `( V M; L6 a- p
3 w9 |& [& x, S/ I) K: ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( X/ j1 d/ P" H% y- E% r( v( ` 3 O/ H. N+ b9 E. k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ U1 E9 [4 A2 H1 o H9 I * f3 t4 W$ y/ W6 s
Request timed out.
+ d/ y8 y6 J. R( R' J
+ [5 T: K" K; t5 C& k, O ………………
3 Z1 |& I1 d7 }' ^( s: i 1 S0 T+ k) S4 \1 R v8 p2 y) ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * Z4 M! z7 J( A4 _
2 {! {# \- m; G [! D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 K# q [2 @# u1 Q! p" g 6 P/ q" X/ s' s/ g( @9 U
Ping statistics for 202.103.96.68: 2 l+ Y0 n$ Y- G& b# z1 ?! n
' p; n# p: j+ i) w Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: * i8 G1 v$ H7 V+ m$ O- \6 K
+ `5 y5 i/ w& A' x" W- A' m/ U
Minimum = 40ms, Maximum = 51ms, Average = 46ms ' P+ N) o: {7 b4 l; y
* b8 Q O& \6 q8 |8 `" q
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
% g1 @, ^! a9 @! A4 t& l4 v
; c, R% Y8 t9 B& ] ` -l size Send buffer size. # h* V4 I; n8 i# D
! L) \) z' |, ]2 s+ f! ~
定义echo数据包大小。 |
|