|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % E- u& w: ]4 Z# A% j, ]( i
4 r5 I. L* D# v' b! n! ?& ~$ U9 t 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
- ]& ?3 r5 F5 B1 d& H6 p * A2 h Y! q3 P/ g/ ^2 y; q; Y
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 : v( l3 r4 d& r: n
3 ~ x- i- n8 Y+ `# a! ^& I Options: * c& {6 a' @6 _
( C' M& f0 i9 e1 x K/ W) e. m, D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , ]" e1 n2 ^7 W
0 ~5 [6 a" y% a% Y; u9 |
不停的ping地方主机,直到你按下Control-C。
f; a9 A8 s; l6 G: l, H 8 U# s3 S4 J+ }) }. N8 m' \; Y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
/ ?. n' n; M b, ]; u: y. t 8 Z& m+ q; T' ~7 w: w" q M
-a Resolve addresses to hostnames. 9 u; j; G! K% ~; C
1 x/ Z# V# _ u$ H 解析计算机NetBios名。 , I& f; n. b7 r4 G3 |- \
9 W8 V+ |4 b3 X9 O- N
示例:C:\>ping -a 192.168.1.21
. n! A0 f2 T2 x
# I, f9 q/ Q+ y7 Z: B Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
! H4 \5 ?- f& t; w; |5 V$ r / c4 w4 O% P; o7 R6 ]/ I& }9 P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 v! q5 L4 h' O2 s! w( \
! ?/ P/ b& W5 M: \9 j/ t. g' T Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 k H) f# L. ~# H4 r
, J! b) m/ F. U& l' t4 U( n: T- N Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 @9 _- p; h* h1 h0 o( G
* i! P+ K2 n6 b% ] M4 C
, ~+ Y: g, b# ~8 m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 ?( K0 h! }: Z/ R
: @$ i. T) D3 _1 ~+ O! E" x1 \ Ping statistics for 192.168.1.21: 2 X% g8 {* z f# r8 y0 U
+ S n. s2 a) r8 C
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
. V9 S/ Q0 C' q% |+ r+ `6 s3 ^
/ N% T7 H3 ~8 g6 h/ \3 T Minimum = 0ms, Maximum = 0ms, Average = 0ms
' i2 @( Z2 m3 ~1 Z, G1 Z: I k4 Q- t
" _5 U7 u2 j7 N) [ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 - V; M( ]$ C! Z
5 z$ Z2 V4 u5 k" u1 L' g: b) {' n# l -n count Number of echo requests to send.
: u5 a/ }/ W' w" l3 o" _3 G
3 f! n* N$ F" e4 y5 ^/ z/ y/ Z 发送count指定的Echo数据包数。
" w( F5 a4 ?/ m |% @! p l 3 f O# v/ a4 G {" \
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% g% `/ R/ s& E; p# P) H5 h( t 2 L5 e% k+ x* j
C:\>ping -n 50 202.103.96.68
. {$ D7 X$ _/ {$ {# a- a2 j0 l. Z
6 b9 O" V3 U5 I$ Q6 n" i Pinging 202.103.96.68 with 32 bytes of data: . o: B5 @* N1 A1 [- X5 l+ ?
u" H* I5 G/ l' N: _) w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 |. r( f$ B) j+ m
' n5 j) I; ` R4 s1 k' Q4 @/ G- |& ^+ b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 M1 W' D" `) n( t# S
! d6 o3 F6 A4 p, o+ Q) M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * } w1 P1 R3 a: u
7 `% a) t. M; T3 p/ f, |; H Request timed out. 9 J+ t+ m& o5 Y
( }# {" I$ |- m4 M! U2 g
………………
9 w- i8 D; h% p3 j) c# ^5 @
' L* k( B U2 Q, t# } Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- H/ A6 q7 i7 {5 C" `: y ; E* k! A8 [9 V g0 M" q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - z _: O* P9 b
9 i$ Z6 o1 p! ~2 R( Z
Ping statistics for 202.103.96.68:
) l9 C( K9 y( N' } 2 ^2 N& T. H: A- w4 U b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
& i& ~2 Y5 `4 a; g
) I1 h# i9 p+ D( i Minimum = 40ms, Maximum = 51ms, Average = 46ms
8 Q4 y9 k5 c: ~# R: F8 F# `0 g + ^) R+ N& b8 g+ L) o5 {; j
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
6 B! W, ]) ~/ j* b' t ! @! a" g* f) ^& b4 S( E' V
-l size Send buffer size. 3 _# B8 N4 Y4 `2 o* a7 i9 j
+ a3 p* C# ?% S! f9 h
定义echo数据包大小。 |
|