|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
" n. L% Q V4 E% q& M/ v8 y
6 ?( `, D- S( `$ Z7 J 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
; ~2 d6 b# \4 H8 j& s 6 f$ \8 C) H& K X$ E( [4 x+ 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
5 d( M/ i' g8 L' \5 q : c& h3 i+ V& f5 C9 ^
Options: " A4 \: ]' q/ [& U- N8 v+ S+ r( G, K/ r
6 a, n: S6 F! `7 o1 M# C -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 B3 }+ c9 o0 ] t, w0 _( M ! V' ?4 `2 S/ b( {0 r* y- e; i! q
不停的ping地方主机,直到你按下Control-C。
, b9 H# T* U% ~; o3 y; c % x( m* A" f* h0 L* C0 \6 p9 a% C
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 o% m# N) y+ S2 C5 B
! K! y- G' o# P. `2 B
-a Resolve addresses to hostnames. @! ?+ S+ a- G( P: O) Z
0 }: K3 I8 D1 }% t* D3 x9 ?
解析计算机NetBios名。 8 B# Z3 u% K1 t' q. W
7 {* C4 K( l2 r% m, A
示例:C:\>ping -a 192.168.1.21
7 J& Q* l2 G# t" \ 9 ]! R6 \; l M
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; h& ]4 t/ ~. H ~2 g6 ~
5 g2 P2 V5 b4 |! [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , u t: L2 {. g/ c
4 d' o X/ i. j- k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 U) G% G* G" y/ m
9 h& y1 d I5 ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 O2 E/ C+ a% Z- \6 B- B/ l
# Z' Z2 P6 ~ O
: @9 N* A* b. a% h) C Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 E+ x, n3 o9 O8 l+ ?9 y. q
, c( b; [7 y. o, q0 _) b Ping statistics for 192.168.1.21: 7 {# S3 u$ G1 ^1 J
; `; W. Y, }" j; R8 C7 N& T' v Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + O; }7 _& S9 w
; ?) V2 I( {* K' Q7 z, t
Minimum = 0ms, Maximum = 0ms, Average = 0ms
8 n1 v2 `: |( H. G1 s7 |2 _( q ( \; F# ~, s; b9 R2 j% e
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& z/ V" |& x* ~, G+ P # C$ R( t: N3 P. K5 p
-n count Number of echo requests to send. 0 t6 ~; u! v% f
5 J" y: W3 q7 D0 f* I) B
发送count指定的Echo数据包数。
+ ]; o- K, w. b8 A5 n: z
- b7 D6 C+ @* T! ?8 u- h 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( x! U$ c. T5 ]' o' W0 r Z3 C, J) D
% R4 [) g) O1 T; _$ B* s
C:\>ping -n 50 202.103.96.68 " C* t( k, n9 Y( M. I) M
; i9 r) Q; j7 ~- L' B0 F' {) S
Pinging 202.103.96.68 with 32 bytes of data: & G U: B6 a a5 u) r( S
* M* z8 {* P! x: N6 O4 ^
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 B3 g; b, \5 `/ G2 ~
" q& Y5 q# f) e w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * a: a3 a! [. Z3 v+ O* t3 U+ z. o
1 ]2 H1 E, Q Z3 _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : [) k3 E" z& }5 _8 G" |( G
* R% t# l# ]' O+ ]
Request timed out. $ n; X9 z; d4 Z. p
# u1 P; X- Y! k; t8 l
……………… 5 a) a: _! u0 v4 p4 j9 `& r: Q
& c* p, Z* @% [: D. o% R+ B q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& P2 r6 M1 @7 Z( `
6 a4 d' Q- `2 C3 _; Q& @( r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 e: C& i0 l: P0 c ]* S
1 M# T- _# [* ?/ U9 u Ping statistics for 202.103.96.68: _# c9 d4 A( ]/ E7 R, o; P
1 o9 I! ~, f- C* t! k
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 3 }2 v# m$ [5 g7 I! v R
8 Q% V' c6 S- F& H Minimum = 40ms, Maximum = 51ms, Average = 46ms * ^8 r0 w/ ?) G E4 j1 a. T
% V c2 ^4 t. N' D5 z9 Z* Z
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
. D) v$ p9 w+ N. ^) F! u ; W+ a# m; P* W8 [* X* n
-l size Send buffer size.
% w# M4 I+ }7 S6 ?4 @
7 ]( m- r( i, n8 |/ F 定义echo数据包大小。 |
|