|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 . ~; P, Z7 ?0 I" }" @! a
, o& M) ^, O% t# H4 r! ~0 S6 V& O7 l
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& ?3 O$ Y8 ^, P# ~! I: K " b# h. ^& d- U' R* Z" e, n* n$ 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 7 T2 g* P' q! s+ M) {( f( O
@% _9 f8 v$ s& m( W" p Options: 8 ^0 I' ]# H2 M/ ]- A
- C" |; e5 ?, t: l: r
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 C2 K3 Z8 {+ B! W: m( N& _
% T8 S& g8 i! @! B
不停的ping地方主机,直到你按下Control-C。 6 F8 I2 Q+ f! S8 ^* G
% f% F$ S3 t9 G! W; I8 Y. `9 i 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 E0 Y- \1 _0 d4 g+ \
4 ^" q9 P. ? T6 |/ i& i -a Resolve addresses to hostnames. 9 f Z* E7 o4 H: U
2 @$ e ^7 _" R2 _, y% W
解析计算机NetBios名。 * {2 U( {3 B/ Z+ j/ ^4 K- O a( c+ ~
/ L9 S: `" s5 C( v
示例:C:\>ping -a 192.168.1.21 " i0 S' x9 @/ I7 g# C
0 u$ D B+ u$ V' B Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 G8 V. @* A$ |, ?! ?
9 t9 R7 I7 ?3 |3 T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 M+ ^( O2 [, Z& x9 Z
) a) N0 j$ [5 ~* W7 X/ E# [! Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' Y- T3 P, ~- \
7 p( U' p# V. _3 K! I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 A" h$ L ?% Q/ ]- s
7 w. l, s, K7 X0 C
/ o+ P- r5 y h z# U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 o4 B# V# G8 [$ b4 I8 ] $ ~7 |) [% c3 r4 j8 f6 C( K8 g
Ping statistics for 192.168.1.21:
/ M! Z4 l- u& |: B4 V- f + `, z- P U- f9 N: C
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
% h% `# i' m# e8 R& ` " ^5 d7 L U% v* [
Minimum = 0ms, Maximum = 0ms, Average = 0ms , E; c! D0 V0 m, N5 K, a
5 L& e, s g4 r0 j4 a
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 & k2 S9 p; o7 v. `
) [1 `# W' \- T2 x3 D( U
-n count Number of echo requests to send.
5 K7 N" }! J& M4 l% m Z$ \ B% r) y : j! ^! |# [6 {- ^* D. o6 @
发送count指定的Echo数据包数。 A$ V* @* O: L: D* f. [% b7 P6 V
4 N- s3 [: ~: B# i/ |% @7 i 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
1 i5 x* P M; ^9 e
- r W$ I/ B+ b; n C:\>ping -n 50 202.103.96.68 7 R* ]- y7 P0 v* d. ^! y" f
1 n4 E+ y( \; a# r
Pinging 202.103.96.68 with 32 bytes of data:
$ S6 @) { F( q6 t' ^ 0 k9 D0 @8 `/ M; w4 V/ w& ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # j( z5 ?, b7 R5 I) H6 E
6 I, s- e' G7 Y8 O7 ~: S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( W: E1 B/ H+ a. _4 g7 y$ w' | 3 Z8 s: I3 }1 ~1 I! e0 F+ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* D7 h6 I2 k# g2 t7 o% \% Q
- V* t# o1 ^0 Q2 ^ Request timed out. : E, w+ z% ?$ X& ]* F! ]* R/ A
. L0 j" Y$ G7 M/ H
………………
. |6 [, Y! n& ]$ W # T& k4 [' g$ J; ] n. G1 H
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 w# }8 d# R" Q9 N
' u4 t. E3 T3 M2 B9 c& ^2 ^' }7 D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 B0 Z) T' E2 i+ w( N+ b
$ }% K2 C+ J8 [
Ping statistics for 202.103.96.68:
. T% U; H( O5 K6 J- C) n
# G- _2 h+ t2 [+ m _8 F Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: * f4 }+ ?* N/ R# y2 W& @/ {
' b; v" V( G9 s5 ]6 @, u
Minimum = 40ms, Maximum = 51ms, Average = 46ms 2 O5 G. |* s$ n8 m' `2 C, `
. s0 ?. S' m* w" w) m
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 4 d5 U8 G9 P, O1 T
- \. @, [- q' `) X -l size Send buffer size.
3 Z' B- [; x5 N+ O4 J8 B: j1 i6 { 4 J; e+ N! N8 x+ W9 ~( t8 ?
定义echo数据包大小。 |
|