|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 e. T* {% g% o
( ^$ y/ i5 d+ V+ g% r1 r) J
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 ^9 W0 K, T/ d% I; v
d$ O9 z& e* \3 k; }2 f6 x8 K
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 7 S) i( K" P5 @2 h1 N) u" f4 Z+ L
9 q' d( `6 t l( g9 v, E9 A Options:
9 h, w8 A: }" N8 ?, ]! i$ S) k* M , \# a: ~+ A+ K+ A2 d2 F6 ~# F8 X
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
1 T; s/ D4 Z3 j B/ U3 x
8 a5 X0 w" _' O 不停的ping地方主机,直到你按下Control-C。 7 K/ {+ T C1 ?% d0 Z. @- s: d
+ n" I) ?. b, y; g1 T9 z4 n O+ X/ ?% ^
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 ?7 E( V5 I; h' `" ?7 o: [
4 s; t. g& N2 \. n& k/ ~ -a Resolve addresses to hostnames. 5 l5 u, f) |- V/ }
5 f7 \2 V7 ^& t% R6 F$ j 解析计算机NetBios名。
* s* K6 x" z) u( e8 h7 o - Q. c! E X/ [1 z' P1 p( ?% A( `) E
示例:C:\>ping -a 192.168.1.21
( g! N, w) [- A* o 4 t: B G' g- v9 `$ h
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
/ Q2 I0 ]) r& x [" E% U" _+ M5 Q4 @
2 Q. U2 k/ M8 R' T+ d Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( [! E5 Z8 D- o* w7 C2 N + C5 u+ e4 e: v% F3 O2 m# M8 w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - Y* e% b5 ^2 h
" U$ M5 g; n( A# L
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; f9 l' n0 B, C5 r) f! W. M$ A/ f0 b, a; e" f& n5 q
& y' V/ p4 i. X& F
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % ?7 H! e! h# ` a) l
$ R5 H; L: Q) x# \) G Ping statistics for 192.168.1.21:
3 q) M6 B3 g$ e4 P! d
5 W* D6 P7 w' ]! ]4 C Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + b, H8 w4 d+ p2 S# O! }$ s
2 F# j: t/ D' A7 n& F; T
Minimum = 0ms, Maximum = 0ms, Average = 0ms
3 o U/ _/ h; [% L+ D * M# D) m2 Y/ r3 D: H0 I
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 : w0 F# A4 I9 W+ d2 O4 F7 O
' `* z: K! @2 i+ a3 Y
-n count Number of echo requests to send.
3 [- m- U+ o+ n6 `, ]6 s; | % C h* f4 R/ o$ ?' L0 K7 o" H I
发送count指定的Echo数据包数。 - U$ I0 M* d& M/ s* f1 W* G
7 ]1 b2 V8 K& y! q, M& h& s 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: & u/ X+ ? c8 Z/ L
- E2 J9 }9 N2 l- ~ C:\>ping -n 50 202.103.96.68 ( v1 u: O z; \" G! ?1 D$ r- S7 w: v
" J* v/ l; L7 H+ K
Pinging 202.103.96.68 with 32 bytes of data: / c) X( d7 r/ G0 ~/ ^. q7 G7 W
/ X- t: `, c- _. d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ L" ^# C1 ~8 `+ U$ y$ [; D% D `5 v# @
1 z0 j8 U1 [: J( q& O" O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; E; {( M( ] l7 w! O- p
% y s( P t7 y/ i3 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + X" d0 y6 g9 R/ j. V" b! N
+ T# H* V* z& T$ g6 q% P Request timed out.
* j' O9 M9 ~# d9 q$ L8 |/ F + {9 F0 a8 l: S
………………
# D7 c! k! V. J5 h
" U7 {; Q& `, z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & g: w ^4 K, V0 H
- ^/ A% V; E9 _. s( r# Q0 U Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ n& u" _% f5 j3 @
r+ i4 p/ o9 n- Q3 l0 Z" M+ \
Ping statistics for 202.103.96.68: . r: l: {* p9 e
0 |$ p8 m2 q5 I Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" ^+ b2 l) \, S: [, K# _! Y
c+ l# o: \6 C* T Minimum = 40ms, Maximum = 51ms, Average = 46ms 4 ^$ v, J- I$ V$ R+ l
1 x. j+ P: A: s8 T6 |8 [. U
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 A% a8 D! m% j& m% Q% ]
* W$ B! K8 a4 f$ O7 j4 i, Y
-l size Send buffer size. # o. @1 J# h5 `3 X+ b* y* w
3 z, _7 B0 U2 j% @: I- s& {
定义echo数据包大小。 |
|