|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ ?. q2 y5 X* w( o3 d 4 s! n3 j' O; j8 q4 q
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ K6 s( e# h+ T# `# y: j 8 u/ w* Y7 }2 R0 ?1 `' Z
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. O/ ^! ] t6 _5 o/ c
/ L2 D& P1 B) |9 L Options:
# T; B. m+ I$ |% z2 D4 ?$ F8 M
; z4 W* d. @$ K$ u& | -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / Q( M" g1 Q+ o, ?' K! Q: a
$ j. a1 j* _: t
不停的ping地方主机,直到你按下Control-C。
7 j- u; Z7 _7 m+ \- @" _: ^ h
1 A0 U' Q. r/ { 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 $ ]0 k. i& ]* ^* m$ g m; T' {
( G% L c/ W! P, o$ d: M6 {: ]3 y3 T
-a Resolve addresses to hostnames. : B2 S5 S2 u$ h6 a% D3 p
" Z# f. W! n! ?& M- N6 ^! e 解析计算机NetBios名。
* s5 i% j+ @. c ; J0 E( k& i* y, u3 {: d2 X
示例:C:\>ping -a 192.168.1.21 ' e O: T& t* n& K5 O3 I
4 l; i: }, r' w Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 O. r$ |6 p5 _$ t& V4 |+ c
* x) {$ C2 x9 S: N/ N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 u* Z! a9 g `+ ?7 Q , k+ l) z6 r( y2 y+ [" O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 i2 M$ z: A; y/ |$ L% Z; \
8 i; M$ t4 y3 A+ W! p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' P8 f* q* \1 h/ g8 M8 m4 f
4 Y7 @; t/ w9 a: K
9 y% e. [1 `. {& T: _( H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # `% [+ H( I. y
~- J& Z7 e3 \ Ping statistics for 192.168.1.21: - Z4 f% s- R7 }! t
) @. l0 D/ Q4 J0 ~. m: O9 e2 n Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ) S2 V) A0 s' j. t
g, R$ a4 B) m) z
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- j# ^% N& e4 x6 o1 J/ u1 [
: t7 G% f1 T/ u' L5 j+ M 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
% O' W# i6 V2 ~: B+ s" m# t: k& s : C \5 x. r8 C
-n count Number of echo requests to send.
, @( ]2 d; t; O2 E4 m8 G$ ^
. g6 T- @6 q: Q: |. |: P 发送count指定的Echo数据包数。
$ J. m% g( |% p' q+ b" ?9 @* n
d# I% T- ~9 f, V9 B, S 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
. ]3 Z! J6 J9 K) Q( g% j% h' w
& Z, Z7 q$ o1 [ c* F, J C:\>ping -n 50 202.103.96.68 $ G. b) v8 m% Q0 a1 T5 c
( t( m, {2 Z/ {: L% Q; I5 t Pinging 202.103.96.68 with 32 bytes of data:
" w+ d# l; e7 v$ N; ^2 n, }
`. [- q7 S4 _. g* }) ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * X2 v! b% k, w# ]- B
! x$ |. t2 M, x* ~' v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ X G V( Y" g5 e9 E
% y! V& q8 n; N7 r* S5 Z1 x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ _4 M5 Z3 Z' X& o2 b) c( h
2 Y' Y7 J8 j3 d+ c Request timed out. $ A$ a0 k/ `7 C0 y& ~1 y
D; x1 r( t3 a. X( n5 X( Z
………………
* T+ C+ N _* i0 A
6 L# O" L5 f% t! o Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' M; n# C v" O8 j
6 p& |4 D0 z+ V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , v, L2 s: u1 |7 L9 k: y8 d+ X. }4 Z0 Z
F7 Z- {$ i8 k4 F; Q6 {1 J Ping statistics for 202.103.96.68: 1 X! n3 ^' [% u$ @1 k& h
' W+ |2 h7 W+ F7 n# V Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 Y a/ A$ {- Z0 a2 N) A" U$ D
" Q& J& S( v8 v' L$ b* b Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 R+ b W- h, }) h5 E% X8 x& C
# J: R# O; A q/ ]" ]. n 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 . _) o5 M/ G- }7 t+ P
4 Q. Z; w: I- ]2 {( r/ u -l size Send buffer size. 8 t' _) Z1 w: } _0 k
) t0 B: e/ m0 R" G5 L: f, a 定义echo数据包大小。 |
|