|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 k! b, {) |3 r7 z6 x! ~7 }, T
2 c4 F# B& f$ m% Y& a# \ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
5 ~8 q6 S8 ?7 l" `- t' l
- v6 x# {& @/ U! D 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. s7 V! j; i " F2 }6 p/ `" e" i) L2 ~' ~
Options:
8 b) x% u( T9 I. w: X, u* ]6 Z * o' z4 L6 P& A: h" x6 D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. + u: d$ q( E! G* M% f$ l
r: ?3 F- l8 o' u
不停的ping地方主机,直到你按下Control-C。 0 w( j$ A/ R- l, q4 b
% ]4 N& r: Z9 K2 S 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ' q& F4 `: y q" a
* f) k! r" W# Z: A# O
-a Resolve addresses to hostnames. # V, } H9 z. q2 d/ x
|/ f* F( @# `
解析计算机NetBios名。 - h( |, I# K) w, p6 [
; E9 T1 G" `7 R
示例:C:\>ping -a 192.168.1.21
0 `7 A# F, Y! h2 Q* R* ^1 s 0 ? B& p9 b5 K7 s+ n. m
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , w% T1 X3 i2 b# R! i0 F
( A2 @3 U, l y! @$ ]3 [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 z7 z2 [' M2 A
* d1 ~0 b! e: N8 _: o) s" f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 D" ~# q% V5 O
9 F8 P1 B* p0 V' |7 C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 I. _( f' R" p# {. |
5 u: W& b# j* }7 r * s( d+ T( f' ] m; i& E% x+ U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
r$ d2 i5 b4 c$ C6 q$ L : s# s# N2 P" g! M) G) [9 e5 }
Ping statistics for 192.168.1.21: " d" w' k. h+ v+ f, D$ p
2 G5 j! o9 ^0 Y' ^( z1 S1 Q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ @) R" B$ w, F
4 Y/ A. V* d! U" {' ~5 [: y/ [7 P Minimum = 0ms, Maximum = 0ms, Average = 0ms
) B r* U* q& U* k2 m
# A; o" k9 [- t4 M1 x! {" L 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. x# X% a$ U2 R$ S ( [6 W& u3 Y0 T% e& }& O
-n count Number of echo requests to send. " m% B. r: L4 A8 `
. V# L! w' q% |9 x
发送count指定的Echo数据包数。
5 p) ?- u2 H6 s% Z& L * Z0 w/ L1 j5 t1 N
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) h1 W7 ^1 E1 M
9 y. u% ^- E5 H
C:\>ping -n 50 202.103.96.68 " x8 w( a! |( a$ p; C
3 r0 L6 Z8 B' u5 N Pinging 202.103.96.68 with 32 bytes of data: . C$ c3 U1 g$ T* P* j
5 W: g% z s' f' q4 H( d; J3 C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' U/ _7 g. n; I& h7 U/ [7 V
- i3 r0 i+ P8 l9 a! T! `! S% z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. |- R6 [- O- }, M9 x6 { ) V0 d$ q" p7 F- I2 v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 b( j6 F2 E. a, h: O g. J ! H9 |% Y, t, M6 r, C' m
Request timed out. : M' U9 W" C9 S/ H- }+ R: ~
! j! c' C7 F6 e K
………………
' Z+ L9 \( ~2 |2 G0 l- w & A z& @" p( r) B
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 f2 i4 G4 w: x( d- {; S
: [) l0 J) g3 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # I( I0 ?0 z) q7 d) ]# ~; s
! D; n) ]- }# D6 }9 s Ping statistics for 202.103.96.68: * x1 P; h3 A4 Y" X; V& H( a
4 C, f( k% C, Q/ D: ~9 Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
: B, g0 t* o$ L. z: B" h$ P
* d' t* M, ?6 U4 I- e; O Minimum = 40ms, Maximum = 51ms, Average = 46ms # n% ^% b" B& f
+ f, W# w" i! j1 E0 w 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 4 x) y+ a% R* J4 L- _! ]
3 \( C3 F: w' R% s3 c+ l
-l size Send buffer size.
, `, X8 B$ v$ u" e% G# R
& ~" w2 ?; K, C( y 定义echo数据包大小。 |
|