|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
. x Z. N6 L7 b. m# d; s " }2 y. [0 N1 }9 b- @, i. T, x
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ( P( f5 X& j* F) e- m) c
! B, x5 g' h: ~ Q& F" Y 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
5 Y/ V0 E0 ]' ?# a, g
; t4 ]! _/ |4 L/ z' n" N& u" f Options:
% }: @# b7 k+ N
, \) T4 n+ |. B! { -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 {1 h% h3 s" R' b- C& P N
2 n% Q& q2 i) H 不停的ping地方主机,直到你按下Control-C。
) c, o( ~ ]3 p
3 J, f" U1 x/ q/ } 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 U# n6 \2 A8 r2 U. C! B) n
8 o# W) L: `/ r9 K* m/ R" C, w -a Resolve addresses to hostnames.
% r: t$ @' a( C+ X2 c: {; c3 s1 }
! g4 q) \- ^- ?0 { 解析计算机NetBios名。 + ^8 l3 t- L2 o/ T
6 q8 R* r8 i7 X) U! X
示例:C:\>ping -a 192.168.1.21 1 l' M% a% e" H! V& A. v- C9 E& O
) J! C4 t' ~( O x+ L2 I
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; ?+ g& W4 W! t& w+ u
9 V8 m( @5 b& C* v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 D' l3 U8 P3 V5 ]+ ]% G
/ X* B& g: n5 Z8 A$ ~# W/ o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 t$ R$ Q* Q" r; C6 ^1 `7 }! B
4 l; v) C8 b% F9 `9 X# o- q4 D: ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + ~2 z5 a/ l& z1 a( Y0 F
) B6 o6 k: V" m
6 K) K) x0 i& u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 x1 f) @2 s8 T9 Q7 t+ s6 s; m 3 d# H& s& M7 M! S: ~+ U: i
Ping statistics for 192.168.1.21: ' E/ I9 f' D7 y( N4 Q" x
S, i4 Z9 b" `: D Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
% \! Y" h9 q" s8 x4 W+ T
4 w, d5 o% ~- m7 x Minimum = 0ms, Maximum = 0ms, Average = 0ms
! R( A0 _( d# O8 x
k9 k) i. P) a0 | 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ P- y+ W% y/ V0 A& O, ^8 G& f 6 Q n k7 b" J, F( z, w; g- c
-n count Number of echo requests to send. - p" ^) ~8 [+ M5 `* k8 J6 s
8 C8 K% u, s3 [6 n. |' r 发送count指定的Echo数据包数。 - _! G0 `3 R2 {
: r, O6 y7 j$ y6 L( F, i
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 2 a( \% U9 [0 u' k
% u4 t2 f+ j2 H4 ]5 ?- a C:\>ping -n 50 202.103.96.68
5 J% t+ G7 [( f0 o ! J/ `% [3 k# h1 A) M3 E
Pinging 202.103.96.68 with 32 bytes of data:
, m( k5 H$ s: S9 ~ $ U- W5 N$ z' ~9 ^/ a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" u7 ^$ E- _3 z: [4 G% n9 u0 @" X+ ~
! Z$ E8 [) ^! }4 ]$ a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ c" T5 Y( w/ q* P. `. \
}! k5 w# u9 E3 w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' f" S; J) @: f4 q7 v
- C) ^+ _2 `% N* S; R$ u: @ Request timed out. 6 g& o! d+ h" X9 n' t
! v( [ ^& x: K: V
………………
4 ~0 o4 Q& D, U# A- q- d* R: a
/ Z6 K3 Q2 n m& H& i i' P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 H( Z7 E( L; S3 Y m8 e ( s: r( {7 V+ y7 I u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 ^' p* n1 R) N
' l7 {3 Q# o8 v0 b Ping statistics for 202.103.96.68:
: o1 Z. R; x( j ~6 H Y+ v) e
# Y6 d" ^0 L. k: T# T3 R Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
8 W( P& H! S7 C# n! R, C- Z / d- I" H E' \0 P' U e
Minimum = 40ms, Maximum = 51ms, Average = 46ms ) ~7 N5 j* M( o. h' W3 A
7 F5 \1 W$ p) U
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 y `5 w: }0 j9 l# x, O( }7 ]
1 R7 f6 o3 N$ p7 U; I -l size Send buffer size.
9 c; E/ T) J* C 5 F3 i6 V8 d3 X9 v& g# W
定义echo数据包大小。 |
|