  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
" b/ `7 \2 d' j+ d . B8 ~( V# M% E2 f1 k
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 j5 Y5 ~8 D& |6 j" `1 U$ l: l% j% ]
! y0 I8 a* `+ J1 h 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
, x% {; F, |7 U. w
7 Z* |& N0 J2 L y: D1 \ Options:
9 R- S5 q6 y# ?
, ?6 m: C5 x4 s4 @" ^, c( J -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. : K5 O" p' g5 U- j1 K) l0 F c. A
1 i9 X, Q/ v: X: X( u 不停的ping地方主机,直到你按下Control-C。
8 J2 i9 u3 Z6 I0 c/ L0 ~7 R 2 w* L9 e, N% W) C2 e2 x4 s2 V
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
8 c' ~$ ~5 a5 g6 u. d
* D( r8 G% c# g* e -a Resolve addresses to hostnames.
5 @& M1 }2 _ L# n . R$ ?' ^" H! Y. g5 V. d* e
解析计算机NetBios名。
4 b: U% d! g8 f& U' I
' T/ G& k& ~, W0 S 示例:C:\>ping -a 192.168.1.21 9 W# b! \6 H7 m) ~1 `
6 {9 E& I+ F/ K6 s9 V/ b9 U
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; g% Y6 O) u1 d
4 U# m2 ]! y7 ~; o! V p
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + Q$ ~" t! T" Y4 ?
5 e6 V6 w E& w1 v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 T1 c# S& \5 L' f- |, y
0 J1 d4 i9 \2 G4 z. q8 }0 E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 V9 f: r% O& u+ u: t# j4 F$ W
& W2 {# j- y- `# z! _ _
( n2 i+ \! a4 ]% u: k) g8 E Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + k0 O0 Y1 E' j: H
0 v1 v1 @' `# G: v% F$ O' N1 Y0 o
Ping statistics for 192.168.1.21:
6 C% L* J( t8 ?9 |
% ?$ d/ J0 t* ?1 I! U Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 C; A, R% F7 a9 q& G
2 ?9 s. t: o) N0 R0 {
Minimum = 0ms, Maximum = 0ms, Average = 0ms
/ j5 _( M* R6 K: D& q# L
5 h1 ^# E* \# u0 d 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * I- Q5 ]; W! } B B
}2 ?, |' E- }" L
-n count Number of echo requests to send. $ s! V- g/ U8 @
0 a K* C# k$ R
发送count指定的Echo数据包数。 / m M5 _; @8 c
$ T0 Z0 e% a& d+ D+ o4 Z+ L
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 H T# Q$ I; o! M
( X" K8 w+ J. }
C:\>ping -n 50 202.103.96.68 1 I7 c( W) k2 J3 {
3 D0 n! _4 k) u
Pinging 202.103.96.68 with 32 bytes of data:
# A, [+ ~4 }! c4 ^$ j" L; E0 c! l1 m
0 G$ f+ B: w+ I z6 w, \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ c+ W: W# @1 v, W0 L; n3 {. e3 d( f 7 n& p; e( T/ U: ?2 r- y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( w8 b9 H2 d4 B1 L
$ m: v, ]+ b+ h6 A4 E# F, E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 i: O/ n$ j. H, r2 F* y* {8 o
2 V7 B/ {; v3 @
Request timed out. 4 N1 [+ F$ I% x
/ ?6 O2 U6 w- G: M% n# Z ………………
8 T& b3 |9 y, q: Q8 k; m2 G $ g" P" @% ^3 W: D+ x- e! m) S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * W5 t* e" l0 ^9 X% m
' ?" d6 Q5 ^. v) F Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 I% M9 a9 q ]) G" k) h
. j+ [# G5 J8 G* ?1 R, z4 \& ^
Ping statistics for 202.103.96.68: 9 {1 O6 K1 Z5 i% O
5 \, `3 ^" V+ ] O# b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 4 ?. {4 i7 g( H7 K/ ?; @3 g
+ H! G* S6 J c1 j0 E
Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ x' t/ }% w9 B! V& x7 u9 j / E6 ^% p6 T6 ?4 {
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 * q8 o( |3 Q5 s% E$ e2 `4 E
& M+ ]% m8 Q% z! b3 i) ^
-l size Send buffer size.
! P/ w' ~, N$ s8 s/ l# [0 \! u6 [ . U/ v7 P3 p8 n' R5 T- Z
定义echo数据包大小。 |
|