|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 m0 F. I, l% b% O8 J, }$ Y ; n$ h6 N# D; c- j, Y
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 U/ Y( X) E- r: L& C- Z4 _/ x * n1 f$ Z+ E! C0 I6 U
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
+ k- ]2 F5 N% F+ G/ U
6 J& I+ R; S- o Options:
+ h) ~, {3 X! a% H( F' L0 Q, i 1 s5 q5 y$ V* `9 z6 k4 P
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 2 B6 \! ^1 f) y! H2 u1 [% H
+ { d) d$ K- [ c. E6 f) a 不停的ping地方主机,直到你按下Control-C。
; ?5 C9 Y1 e. a! c 7 E9 d/ N; I" V3 }3 i" ^
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 # a2 X; U; G' n4 Y$ h. U
Q7 w7 ]6 C7 s8 F. e) E+ v3 A2 p
-a Resolve addresses to hostnames.
& X+ Z9 _* M2 ?! @! g 1 g5 S* H4 ~5 l6 v
解析计算机NetBios名。 ; [3 i" K7 }7 G' H# F
2 V" E( w9 J7 G+ I6 `$ { `# U& d9 O, s 示例:C:\>ping -a 192.168.1.21
* p' z# m8 j& \( q7 ^* H
) Z4 h% O4 y G Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # h* o7 Y R8 E# z7 X
* N' K0 J3 U$ h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 c; | Y1 Q5 j( p8 X0 G
5 T5 |) v7 O: x. R N6 O* q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 c" u* o9 f- X2 H- l
: D# r: r8 Y/ r: x! }* W Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / n/ X4 a% h) S1 A' v
, E# ~6 q& ]2 n4 E
4 q$ @/ x3 W0 ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 B) Y) q$ R7 p( g5 t* u. D
( \; f* g5 f; _" Y
Ping statistics for 192.168.1.21: 4 r% Y6 h6 K) |$ H
1 S2 i7 p! X. K2 S
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
! h2 {8 u1 y/ `! P# _. ? , |# ^6 E8 q4 X
Minimum = 0ms, Maximum = 0ms, Average = 0ms 0 r* I1 @" C5 `! \; g$ ]
& @1 V! w% k' p7 [+ a" \2 _" J+ n! m& l
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ n2 D0 h- K, l+ h6 T
8 v2 K8 ]! }$ K0 l% m1 m& f -n count Number of echo requests to send. 9 `) j) c( Y9 |+ O7 G r
8 B3 x2 Z1 |' J& n3 i! O% e' q
发送count指定的Echo数据包数。
7 |$ e1 e* @+ y2 v0 q ( z1 l# e" h( W( C. y, d& R
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 b) A) P' |6 ^/ p+ M4 `
% ?2 A/ Y" [' [, D) a. h1 R C:\>ping -n 50 202.103.96.68
; E/ b6 C9 Q/ l5 e ^* E( T1 k' h" |, U
Pinging 202.103.96.68 with 32 bytes of data: , G5 b7 p+ n7 I9 X% d
9 f" h! Z, ~8 _8 d) R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; z9 T/ F+ d+ Q$ y4 u- b7 h
5 i1 c6 u2 Z6 _( ?; m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 o W: r6 j5 b; @& V0 F
+ L* o( _5 T" u& I& ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # Q7 r( V' ^/ i( Q. h3 `
& b6 a* i9 t3 j
Request timed out. ! ?3 p& S5 q- d) k4 y( I) T- u
C/ o/ R- ?6 ~0 D8 B" {) }
……………… 3 M* N- ^. a# {' L/ W- [0 G# Z) K5 K
( h- G8 F( b, @* ~, y0 |( H& J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; `$ y& l7 I/ [9 k4 Y
5 K. U9 \) S, k" f2 ?" t7 N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, q& S0 U" {6 L: D% i+ ~( W: L % X: r) r. w; G" X1 ]: g
Ping statistics for 202.103.96.68: + {/ [- `" e. y% J& r2 M8 G
; o8 `5 [6 b- ]% r: z9 @
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. n* u) T) W3 _* O) f Q9 k k! I 0 A% D O2 K0 f% K& M
Minimum = 40ms, Maximum = 51ms, Average = 46ms 6 G% R% U3 |+ V! g
3 L P3 ~4 P* f7 Z5 k t
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
% I$ ~, O$ k/ J+ i; X J% k3 l/ U! L( U% P
-l size Send buffer size.
7 w/ {6 s5 M) I6 Q k ! a3 Q2 a) N5 R5 `8 M1 j
定义echo数据包大小。 |
|