|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, o! ]6 {1 _0 j+ [( ~# E
: z& a: k! q: ~5 s7 ] 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. }- a1 O$ @5 H# }% W
/ u4 d& a5 o6 B3 }) m) 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 ' B! F6 `, I3 o* n: b/ l3 H
1 ?% t% X, X) ~ Options: ) e. m+ D$ Z* F) M7 J l0 Z; Z
% J d1 \0 Z) I/ l' g, `$ H' e -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # W) o; h: ~" S J/ L; S
% X$ [; X6 a m9 s 不停的ping地方主机,直到你按下Control-C。 7 {5 q Q3 w0 I0 m* k
! D3 }5 ]" w/ r0 q+ N
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) x% W- }4 \+ e
% j5 k* |; z: b
-a Resolve addresses to hostnames.
" y4 Q' P% \, X+ N3 H7 ^
) ~7 ~) W" b# e) L- c2 a" K 解析计算机NetBios名。 5 I( v) } U4 x4 N. C% y: S
; F$ j0 y! k8 \ E3 H } 示例:C:\>ping -a 192.168.1.21 - V7 I5 F& g4 Q k
, _) D: n' X* M5 f1 ]# Q2 Z2 K
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# e P( Z) }9 b5 U& U 2 [) I3 M5 {& C; v" W/ C5 I
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 [* a* E! F6 y" o4 h
6 R6 C( |$ `5 K7 q( U6 {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% b& I9 O, p% X b6 i- K, m' J Q, O
. p! [7 p0 M9 ^+ @/ S! u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 d2 \5 T3 I- s: T2 s; l
' f) q6 p/ w. G" e/ i 1 n/ m: ]! n ^4 |* ?- Z: u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! I7 q g& ? ~0 x( R# X' s z
- n4 y# O# h9 Z6 _
Ping statistics for 192.168.1.21: " u5 @! L5 z9 [1 I- s J
1 J' S! B2 Y: X, p* |
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 6 @3 N' Y1 @- m9 d
% g/ i# Y/ c7 q( r9 M; V/ R; |
Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 R6 H1 \9 \0 I% ]5 D8 A % m6 i% s) l B7 @9 R5 Z
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
a& X' O) _; R% ~+ h9 \1 f" k
4 q. s, Y, G8 u' e( | -n count Number of echo requests to send.
& q3 t/ J% I. w5 G I6 W
+ b4 e" A. k2 r 发送count指定的Echo数据包数。 ; Q% q( h E8 `) ~+ K3 @; ?8 J& r: s
9 H$ H8 n x" ~
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- {* g- E5 J }+ F) f8 Z1 r/ r0 _ ' M$ Z: {1 S! N) ]% d
C:\>ping -n 50 202.103.96.68
- Y2 K- X" |* ]1 m) Z* K& D
* |6 K% W0 d8 y9 O. e Pinging 202.103.96.68 with 32 bytes of data: 2 V8 R6 k2 w3 r
. ]6 _1 i: @# s: |. P, ?1 c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # f' f% Z, i+ l1 H: d4 u! N
6 |( }! G" i+ R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 R$ G9 X# X) ~" L3 U7 y! Y, ~5 Y
- `/ D( R* T: J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ _& ]. L3 V& C4 j* g
+ W: Y' }0 X1 L" u5 H/ X& r% _
Request timed out. " a& u! P3 g2 x5 m
5 j9 ~+ X! M) _4 r& g8 B ………………
8 ^5 \% v) s& D9 C; R
# s Y- a6 Q' i' v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. Y3 p0 N/ @7 y* c 5 {. W& |5 r( |' M" i' j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( H' M& x: z: @# f- y2 W; J5 ^
, G2 s/ i7 b: h( e5 V" \
Ping statistics for 202.103.96.68: 5 {& ~9 t" d4 H/ s5 g. V4 l4 X
& ]0 ]) f* _1 D# H: }$ s' E
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
& a% b9 s/ D G5 A* o; s9 ?2 x# ^
* l- {; p3 {+ Z! p% t Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ |8 B @" J# `" d% d
3 O7 ^" Z7 w7 Q& K# c 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
0 |2 K. x& G" w1 F9 T5 N# w4 H0 {. r 2 r6 N. L, f& K% l* y
-l size Send buffer size. $ C+ @& w: ]$ T4 K6 S/ e
5 t0 E6 \" \) ?
定义echo数据包大小。 |
|