|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
/ L6 `' W0 @: L" x
* n. l+ k- J# s% i# W 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 }$ Y H" M6 X' V5 ]
$ M. y& L4 k3 W; R$ S) H" X 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
2 C1 M9 Z D$ U2 G& c, G # h+ r- u; L: ?5 |$ [) Z0 w
Options:
. K7 R) g8 ~& ^ / x. T1 i# W! l( B& S
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / \4 i, [/ k; t' A
2 ^2 b ?, {) Z. w 不停的ping地方主机,直到你按下Control-C。 , y" ~/ Q4 ~& z2 O+ U3 z
* b7 u8 K2 s) o. \
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 7 `4 f2 A& t7 U* R
: P* }. m) c9 C -a Resolve addresses to hostnames. ! V8 D, S$ Z& t
4 A/ Q6 K* X) B1 s# p4 y0 j" v) H& u 解析计算机NetBios名。 ' }1 W) o: ]9 C
' D( o5 R9 z; U0 W ~! p, [ 示例:C:\>ping -a 192.168.1.21 / n. @' h% H o# \$ B+ N5 q
& L! H' ~7 K) ?: z8 H Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
2 q* Z* g0 O t1 ` 5 x# L; z$ |+ M2 m) ~- j* A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# }3 |3 C3 Q9 ~$ @; c, D
8 `! K9 T& s5 q6 V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & F0 I" h4 D$ r- d. L) q9 N
) k' z& S. m3 h5 b' x+ d' o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' G$ \7 a" f! \7 t
4 ~& I, l. d" b3 P- j. O
8 Q% W# g! A$ I( t* K: Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . d# F) K+ n$ p( s/ G& A- v- j% r2 _9 O
) j& [8 y+ x2 i- u% n K Ping statistics for 192.168.1.21: ! J4 ]; L0 N, L; ]
' \( z2 G. F. J
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + s8 o) ~2 }$ Q* u! v- P
) h6 {6 ?, e/ s. N$ A0 C) @0 a
Minimum = 0ms, Maximum = 0ms, Average = 0ms
0 r3 X6 w7 [2 I2 k5 V* u# I
' L! N5 g6 G1 _0 z& [ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 M( D c C" N: i+ p5 o4 l
9 Q# ~3 s$ |' C o2 L0 ~) \
-n count Number of echo requests to send.
! c: {' e; [; q8 E $ w1 S. f9 ]- J }. ^$ U
发送count指定的Echo数据包数。
/ T- _0 `3 P- G7 V+ u: x 4 y+ w! Z e* u" k
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 5 D& }$ U4 R3 c
5 E4 X1 C) W# @5 \
C:\>ping -n 50 202.103.96.68
! R+ Q' {- o- G3 B! H 9 A: J1 V% i1 A5 }2 ~
Pinging 202.103.96.68 with 32 bytes of data: " ?5 H! n2 v- ~( x+ Z
5 Y3 D6 H$ V C* G+ a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& R2 g/ ?. V" x a
3 v" s: ?9 K7 G! `$ x4 S4 N: z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 f* U" t% M% x
/ \( m0 d& c- @/ h: \5 A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ X- b# B( {9 ]+ ~0 ?. [ N$ C
- T4 A0 j2 ]" K/ L1 c. v Request timed out. & p- N3 a4 T: w# f5 |, S
" P. s, X2 D! ]: x1 R ……………… , j5 ?+ G" ]+ q- Z3 h( H
/ v+ }2 O! x w: P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 Z0 r. \& |6 z" T( x. I: e
4 ^, l! ~" D# T& E; K- K& { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% l: \0 O" f, q3 o- H
& k! @1 B) r( I, L Ping statistics for 202.103.96.68: 0 h& m4 {& @1 r9 I( Q1 m
j; X! y* s0 e# J' n
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( L2 |, i- I0 v9 v4 B0 y7 K6 |: i& K( P
6 z m$ T. ]# | Minimum = 40ms, Maximum = 51ms, Average = 46ms
: b. |; y; n0 X' x0 y
7 _5 \0 o5 C# r9 X 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 - \. _( p( {- y" o5 K" ]
5 R- b# o. @! L& s8 J8 Y
-l size Send buffer size. J; v$ J* K5 R
# v0 e5 \# p# T/ K8 @, z4 {) a( ?
定义echo数据包大小。 |
|