|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
9 H: c' L, \1 p' R1 c9 p t2 p$ ~/ U
6 p- ^5 P( W u) [- Z6 y 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 h |" n. V0 N
) o( Q1 x0 B, O: 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
% S X2 c$ Y5 U& g- A2 @
' W; ]2 i( v( F) F& ~ Options:
: R u1 S* v9 o n. I8 ]+ Y 6 y/ M: S/ x. q2 v! T" b7 t' o
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
( z5 y/ @( x P- _ - Q# l3 N$ v, T) K' h( }
不停的ping地方主机,直到你按下Control-C。 - E* j4 A8 Y9 n* ~
! F3 Z, |' B4 z
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : H& W: J7 Q- H
. n( [* z8 l- h( p
-a Resolve addresses to hostnames. & z$ @/ a% u9 }4 ?& Z* v
8 C1 J. H& r, y5 L" F6 D$ y 解析计算机NetBios名。
7 m* _; n7 d2 L# Y" z 7 e+ p$ W" ^4 |
示例:C:\>ping -a 192.168.1.21
" S9 O% L5 g+ M2 x2 K' k0 I- L
x3 D; U2 T) [8 } Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( I" R2 Z3 t' @7 g
5 Q9 o! `) A2 Q4 m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + F1 @' u, d4 {! M, I& l
. |4 Y2 @; b/ P' f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + I) @0 H2 s1 o" A5 L" a. T
: @2 A' @7 D( j s6 J4 I! b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # n _- {; S/ S6 {7 y$ d
& S% u3 h0 o; x( o+ T; ?; @% B* s( u
/ u- }. J# R+ A! P" ]; q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 @9 f7 ~% W0 m" r' A
. D, g$ ?$ L) o& C' b8 R, k7 Y4 s
Ping statistics for 192.168.1.21: 1 i# H5 w p" m& _
4 ^4 ^- E& x/ U% q' T7 g, F
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
4 v I0 b3 s, y9 k - w) }& o) w- j4 t* c
Minimum = 0ms, Maximum = 0ms, Average = 0ms . c; t' s' O+ f, `
* l# X) H; o9 w# y) g L4 L% Q- l 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ g: t2 U% f/ c8 H# \2 ^
8 y3 t L1 B4 K3 T# U# O0 u! F -n count Number of echo requests to send. + S" d$ V, W4 I" `' e- v% Z9 L- @5 m
6 {+ [6 g6 ]4 o: ], G K 发送count指定的Echo数据包数。 2 e* B. m2 p, L
d: T5 D# y+ } m
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
4 |1 Y2 J6 S3 g
# X" a0 |8 m g+ W2 z, {3 O C:\>ping -n 50 202.103.96.68 2 w8 ~9 i' H8 O8 [; [. L, A
( i5 L, p, w) O0 \! Y) @
Pinging 202.103.96.68 with 32 bytes of data:
: V( \# Y" U, \9 y( c c; ^5 T1 S - I2 Z7 X' Z5 S) P9 H0 `! M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / q7 r, x" A: M7 Z* E
$ j! \. G5 Q N' X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& X V4 _: d/ r" o( ^, z9 I
3 Q* K8 E+ N( R7 J& W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " ]+ E) g# {- @2 T: _
. W6 v1 f# y8 ]; K# D+ G, K o4 E
Request timed out.
: t9 I- R+ D2 b$ `6 L) w) |
8 @! ] i8 i4 Q2 P+ h" L# e; P! t; V ………………
* V& `; x, ^5 v! U, @; O M' k, k: \
1 D8 z6 D6 z2 Y$ l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 G- I M1 g* q$ E& L# j1 [
" P. ^, h/ P6 n4 |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 e% j$ g3 {/ A9 Y4 P; w
/ f' D) N7 `3 S& h0 |3 s Ping statistics for 202.103.96.68:
9 d. X' p3 _* \1 O. r8 E! F 3 x" {" u1 v! D6 x' s5 o$ ^
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
) E: `# ~7 V1 V9 k1 Y
. o. V) x7 P) m% U Minimum = 40ms, Maximum = 51ms, Average = 46ms 3 E. ^9 v4 \1 l/ a5 K
6 u* _0 ?+ j! V" y& k- U2 y9 a9 V 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 s# q) X8 O3 U9 j% _
$ M6 X1 T6 J: W* T3 e -l size Send buffer size. ' }9 _( o' u7 S+ S) o6 h
+ E8 B6 O# {* b2 Z( y 定义echo数据包大小。 |
|