|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, K3 a0 W7 H9 W, W9 T y- w( n4 P0 d4 ]5 X- c4 y
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ' Y( s9 t1 e2 X; C/ w
y, a! R" D) z6 G( \ 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
3 f$ i% ?) \% B& J6 q / p! x& L3 Z7 S! s6 C9 }
Options:
; d z7 k- c3 T) [ ]6 C ( G {- D) F8 ]" Z5 W* J4 P" L
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) c! r8 S0 ~5 e( d
* m1 Q+ c7 N4 Z1 k, I$ S
不停的ping地方主机,直到你按下Control-C。
" ~( j! A4 w& K( w & I3 c; {* I3 t- w/ o- \
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 - N$ g5 M$ ^! I+ N4 Q+ }
, G" s U. P4 E
-a Resolve addresses to hostnames.
! ], u* u& i+ x6 @4 |
$ u& U {+ k) k1 V# L 解析计算机NetBios名。
+ i n g$ G* e" ?
7 M0 ^+ @$ e, ?& F6 a8 E 示例:C:\>ping -a 192.168.1.21 ' ~7 O% W% L' Q; ^4 J, {0 b
% M5 O3 Z3 A& V. R
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
4 z! B! K8 u9 r9 E J: t" k
! Z0 G( g3 q& ~/ }4 t8 y: k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! G5 M: K/ w2 O5 ~( }
4 Q* M( \- f' ]5 i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 o$ b0 |; n' v& c1 X0 y 2 a+ y3 Y a- R W/ \+ p3 x! E0 g; Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- ?: j7 [* a& ~" D9 G$ O8 H6 s5 I
+ U2 {. H+ P: z1 v" [( P 4 e2 ?8 B& I, ?+ F0 A* H+ k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 x( P) |. G! ]2 F+ Z
9 J6 [' `# I: q
Ping statistics for 192.168.1.21: / m: c' {. q4 b9 _/ b6 V/ e$ q
" k6 x! c# e+ F0 e# r
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 0 X+ u ?8 D+ x# G
: R+ `. C" |8 k1 d8 z Minimum = 0ms, Maximum = 0ms, Average = 0ms
% W- U% ?. J6 ]" N4 `" Z% R ) |7 N. t( S- g! R, j9 ]
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 3 ?; }: `" ?, Q+ j3 D% L" o U% J
( c( h" }2 U* q% ?; @! f$ d
-n count Number of echo requests to send. * f( O% Y0 Z0 T! x7 U2 Y% d: o9 S0 m
7 a4 Y! s9 ~' j- q- E' D5 s( O
发送count指定的Echo数据包数。
5 M/ X D$ f( y* D& |
$ ]( e! a. L# w# A 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: $ L- B! a$ `1 s4 g
) j0 w4 f5 E/ ]8 p9 ?' ^; D6 N( G C:\>ping -n 50 202.103.96.68 0 p! ]. x! p' J" _! d, `/ e; u
$ |3 R2 B( g( A Pinging 202.103.96.68 with 32 bytes of data: 5 d! C. t E( S; c4 ~* f$ j
( S, Q( P& \0 z5 c6 E% h- G* h! h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" m6 ]: ]/ j+ a( b# x
h e7 A9 S. R) F Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- T9 g' v! F4 E; w0 ?( P; R
8 Z4 k* Z0 e- B9 M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / ?; u' w1 p7 s" `3 m
- f4 ^! p) r$ A& {/ \4 r Request timed out. 4 U0 p8 H |6 Y
! \; c7 j& T' T @% B+ w ………………
+ p+ [1 H2 w- l& e7 G( \% n7 K
7 G- l( R8 n, [ q7 x, k4 r g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ [1 k! X* Q5 v( M+ g
' W1 `0 \) ~5 X* s% g7 W* ]8 B Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( H) C( o/ y% Q7 h5 n
) ]( W9 P7 _: b2 s4 k Ping statistics for 202.103.96.68:
2 U# Y6 \, j9 x3 m5 v0 T0 c) N! e& _ ! H% P) b+ D) q5 b+ q7 ~
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 n3 m [8 ~! F; V3 |9 E/ }6 t 3 s& ^$ o; c. M- [ N3 m
Minimum = 40ms, Maximum = 51ms, Average = 46ms ) Y9 b: G s0 j- ^0 x0 c3 }, s8 B
% e6 m9 k8 T; {( U
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 M1 V9 o7 x2 B' @) S+ Z8 ~
6 j8 V% G) U* I* S0 v* G -l size Send buffer size. ' q/ _# h/ `' ]& {0 y
# Z8 Z: N Q6 h: X* C, |" U# { 定义echo数据包大小。 |
|