|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
b: X, T5 M; q' ^& x) R ! h1 h# o1 Z3 ~$ a
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
2 E2 S- T' ~$ T, b( y+ Q
: g. o# l# k9 Q9 j- k o; e 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 1 M; k4 d) P& d
! F1 B$ s' d7 g Options:
Q, D, D8 h, z" \- Y7 g% e 5 g9 [$ W, n+ {9 ^/ ]* }* ]
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ; ~; D" k; |# K; T9 p( n& A4 t
2 G. p" q* \! Z; p* w; l# H/ N 不停的ping地方主机,直到你按下Control-C。
6 u5 k( u5 h* ~$ a) i
6 ?. M! O3 R9 h# l; L 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
8 n6 U- B! t4 l% p
- N4 ~2 m- K, W+ ?4 M -a Resolve addresses to hostnames. 8 F! i5 M" ^) v
3 D$ v! s- O+ U+ ]8 G- k4 k& h1 e& b
解析计算机NetBios名。
. B1 s2 X, p1 S9 Y5 A6 `
. K9 |8 A! `& q4 y 示例:C:\>ping -a 192.168.1.21
! R1 h: B# {/ k2 X * u: l4 d( ^' L+ V
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 5 A1 [: j! `+ O4 D$ Y7 u4 l
" T+ L9 j) q8 K+ K! q o$ `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 @7 f) c+ c; l3 ^' r* c$ n
7 o# F# r i2 Y/ f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ T8 K* V0 |# B( V% z , ~( f: ~+ G; H: v# v5 B
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 M7 O, q8 ?1 f* i# R
1 i! d' L* K- w9 c+ v Y1 X& o5 D $ F: H( h8 y( T, Z5 w- k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" Y3 |' \& E$ {+ e! y
* B' f: P! |4 O8 T Ping statistics for 192.168.1.21: + G- U' f: l1 y. C4 J$ r
# T* n& Q, q' Q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , j4 F# N& \, c! ]8 s# U
8 f& r" S5 ~" F& a) y: _' _+ f
Minimum = 0ms, Maximum = 0ms, Average = 0ms
5 _. z; r8 M6 K- e" |
* z" y+ d n+ @1 L3 U 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 _% b5 |8 k4 Z+ ]
+ Q% O$ P6 e. _7 ~4 S- F -n count Number of echo requests to send. z2 e6 `2 M O2 N F2 A: H
9 Z3 I$ `& s7 Y/ ] C
发送count指定的Echo数据包数。 $ r+ M& g) ]9 C6 \
T3 `8 N0 V, A, @2 i" g
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) J) A; Y* o4 u% X$ J8 E+ s 0 o2 x* h9 a# A. o
C:\>ping -n 50 202.103.96.68
7 _' r- i! X" k# R; V6 b ' f* p) Y) @! x8 F" j+ B) R" e- b
Pinging 202.103.96.68 with 32 bytes of data:
1 [8 k& `+ B5 f; j3 o$ w
' U9 p; u0 N! A1 I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ v# E7 b: S/ B( i3 v 4 O( U5 I7 m, |+ V5 D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' P) y; p2 Q2 Z# s4 x! {
) e# U% |$ j, L6 _) r& E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 w! V7 G: P! v
8 ^4 r, W% p/ G4 a( U! k: H
Request timed out. # I% u6 G; l6 b) T. j
% f5 o3 x! d1 K" d
………………
0 o/ D- r2 ~7 E. i* {1 l- ~9 U" D9 c 5 ?. J5 Y1 @ h0 V0 K7 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; y% G0 G c7 A" J0 v0 i+ V9 \
) ?/ Z( I4 Q8 ]8 E) D7 n# T% K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 [1 R, c9 o* O- ?0 A8 [ 1 p. s) D0 I' }* Q1 U. _
Ping statistics for 202.103.96.68: $ s% n0 b/ l) c5 A5 K+ Q$ X3 ]
2 x' o0 Q$ P2 m1 b; V' D
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
6 }# l( O! i! x* _- f# D! o
5 {6 z0 B0 z2 S3 u7 w Minimum = 40ms, Maximum = 51ms, Average = 46ms 3 k; L( h/ p5 E4 l+ Z% M4 f
9 {, {, h# M1 Y% S 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' h# A/ E# G+ O7 [ U6 D9 l
: l" [6 s, y A7 M# R! d
-l size Send buffer size. ' S8 W% [/ L! Q. L+ i2 S! U3 T! B/ W
& [; O6 R' b* u: y& @5 G4 b 定义echo数据包大小。 |
|