  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 r" d7 z3 ~3 \; H
2 Q- t, I1 d% n: E 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
2 y/ L/ W3 K" v2 ~" ` : `7 A$ q: b3 m5 H% X0 {8 f
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 " [5 S+ ? Y7 L2 g5 @
" r1 Q" n, O* ~9 A$ ~* P2 M Options:
3 y7 P# R# W0 w0 i6 E3 D4 T* j
* w4 X$ A. f: d B; `' k" _ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / ~4 E/ c" X( j! r1 J! R0 d1 w
; |3 p5 f) b; ~
不停的ping地方主机,直到你按下Control-C。 ; h3 D; F. P6 x5 R
5 O( e2 Q. g% e9 m
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 f V2 {/ ?: _) C ` * b1 m1 e- k: \' h3 a4 q0 p
-a Resolve addresses to hostnames.
; M2 W& c: l/ B1 S' Z/ T2 w9 }0 h/ K. H
1 L: A: b* @( P: V7 \6 s5 X# o+ ?' g$ ~6 r 解析计算机NetBios名。
4 M3 `5 F4 |2 R' Y: S . Y# n y; Z+ q K$ W1 ]3 v
示例:C:\>ping -a 192.168.1.21 8 C( K1 E) ^. l3 s( o, j8 s: H
5 x7 t \! Q' {: A
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ W- a: r: @9 q! m7 w4 U4 r
( w; z! q4 B- v4 C* z' j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) [- A1 y. Q% f3 N
9 p; `$ j/ {+ b, G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 z7 T5 n# `* I5 r4 o. \7 X! M0 r4 ?2 j
" i) D7 d7 H2 h1 E Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 _3 E W- I% k& k, K. D$ } u' @: K2 y* X/ U6 c+ Q
1 Z2 H: n% ?6 d/ R% p& |$ Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 w( ~* _9 y+ t( k" o% `) H8 `$ m
6 S* T& |1 q" B Ping statistics for 192.168.1.21:
1 L" c' n: n1 x: j0 m 7 g8 h$ A5 l% E+ z3 _
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ) h4 `! t$ \/ }$ }# {" H( g% c
F1 @" e% n$ R" C* v Minimum = 0ms, Maximum = 0ms, Average = 0ms
- w2 R. @" l) ^$ ^# s
4 [$ D1 }/ S# w. r! T' F7 i 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 g0 K, t4 d. N7 o
! d8 `* k; l0 n/ _* Q -n count Number of echo requests to send.
8 [+ _/ p* d. L
. e! _, ]: ~$ q f 发送count指定的Echo数据包数。 # P6 C3 G) {6 c/ V
/ ^/ k- b# [ E: `
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* G: D; N3 Y7 C9 E0 b i- W$ L2 }# D' l, x$ h
C:\>ping -n 50 202.103.96.68 8 s' Q) f6 P7 \- {
$ ~! C; l3 R/ G5 q! U Pinging 202.103.96.68 with 32 bytes of data: ; N/ N/ ?- l/ Y" q- T5 c: k. N# X
% n! l2 x' }/ Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- C" W F( w, `1 W6 R) S, H
# J. N* b2 b9 T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) k9 N: [5 Z4 }; ^8 }' I
! L; L' [/ X4 a) b$ J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 p" z. v5 R8 \6 V) n4 o
3 Y# U4 R; X( r7 T( a Request timed out. , S- y2 G7 |3 u7 z
4 y8 m2 X; u3 {
……………… 8 X1 h) S: H+ t) S! W8 r0 Z4 T, X: z
/ @, k# L. E- Y/ Z$ U. u; i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( k- {% l! `4 }& k5 _: H$ F. M ! q3 p) ]# {1 q& p6 F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 |+ M i$ E0 C8 b
3 Z( h* |$ D z+ r! R0 y/ I" [ Ping statistics for 202.103.96.68: $ q* D) f' }! a% l0 ^( v. {
7 [8 i! A- {: [$ P Y2 `9 s; h Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
, _& t) s5 A9 T% s; z+ I 0 ~" }. r& i* E9 W$ C
Minimum = 40ms, Maximum = 51ms, Average = 46ms & s, q8 b/ A& ^4 Y
" n& y3 Z" o- v$ ]) x! [$ D 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
p1 G. B$ }- r1 J& m( Z8 h3 L ) V( h* h& p; ?- o6 F' o
-l size Send buffer size. 9 j5 A, Y. v9 z- e3 _( |
- w# [( h7 O# D9 y$ U
定义echo数据包大小。 |
|