|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
" s* y& E& q, G6 [3 H, a
" B: D, d; I& A 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. I) ? t& n7 @+ |" z ! x6 M1 d! | O5 P d6 U, L: m; B! J
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
* F& ` y* w: x$ a8 Q+ U$ Z 8 A! \- W# a! a: M/ J+ p
Options: + g2 J" ?% l$ R( B1 z
& n1 h1 l% p- `# r( x4 r6 I6 M -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 4 `8 A7 |& g1 G! o' |4 D; M
( R; w j3 y# Y# D: |! s* ^. s0 L
不停的ping地方主机,直到你按下Control-C。 & ?3 U+ S% w) W9 b; R$ Y
$ }3 R3 K6 n; e0 ] w
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 S5 f! I0 N9 R p# o( w% @
5 D: G6 \; G: q6 N" M -a Resolve addresses to hostnames. " ]! t. I: h! _% R |8 Q1 B+ q
1 f3 S7 b) C6 _: |0 F4 C; c
解析计算机NetBios名。 * T4 {0 J& v- b5 |; o- [
9 i; ^5 S' H& p4 w
示例:C:\>ping -a 192.168.1.21 % O+ E9 ]. W& b3 z. W7 [
4 Y8 z/ V: @6 @& d# t Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # R( X% }. r* g+ U% p2 e. q$ \& F
; l7 x! o g% E9 S8 t Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 F0 T* U* c4 J7 ^% Q2 \
5 p% @ x) ~( G; u P9 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' ~+ M8 L7 I; H' Y7 n
# \8 F" q/ v; [$ [" C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - G5 m8 O5 E, k. H& |3 \" C% ~
+ R0 u* o4 l* _* E: s G2 N. k
3 j8 T9 d! ^) ]( f% L% P/ G9 h2 `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 [; c- K- a/ _/ k! @4 r 6 J Y( m5 F! w
Ping statistics for 192.168.1.21: ! l3 R6 {* [1 Z: G) [( e7 @( x+ Y
/ r) w {4 B- q/ q% t$ |8 F Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ p* [8 o8 |% S , z& A$ e( @ n
Minimum = 0ms, Maximum = 0ms, Average = 0ms , p8 C3 {# [4 z P" u9 @. a+ r8 \
; u# s$ P9 r+ I$ G$ O" |# V! z 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * `; ?4 |/ U G& d5 J
- h& P1 z4 @- B1 i
-n count Number of echo requests to send.
# p X; m8 h8 H$ ]. Y; v * r$ B9 V: }+ v" ?5 L$ R. H
发送count指定的Echo数据包数。
0 z) H- L9 c- I- `8 x; d 9 O; u7 U3 C; G2 b$ ~6 U
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 ]( I% n$ E) Z- x+ Z |
& @# K8 H4 t9 _! Y% M% N C:\>ping -n 50 202.103.96.68 8 q( {. B8 d$ I) t' c& L
5 u8 T8 B% s* T Pinging 202.103.96.68 with 32 bytes of data: 4 V$ h2 @; y I
& f8 ]2 [% n, O5 u. E" V: t7 X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: {1 `6 c0 i' ]- M! ]
+ [# G& k0 z* T& ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 b/ j& w5 r' C- c$ O" ? ( {) R/ e! H6 S) h# e2 E: `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ A, K9 L, y- W6 ^+ c+ k
. j. I+ w9 k6 G Request timed out. 8 |2 s8 R1 ]/ g( y: d
4 l5 R/ _6 }1 U6 G
………………
# s2 O* N7 G- z
% O$ f* E1 _! M7 v2 I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! {- R9 H0 r5 K% {
& M0 g& V* h4 o+ T0 ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 w; y& Y! k+ U1 s* i' Y/ a3 ~
% `1 H: \7 |3 n7 Z: v2 q2 @1 e Ping statistics for 202.103.96.68: g, @& I$ u4 K' ^6 {3 Q
% u T$ U6 X6 l) O; v- U( Z C
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% a( n. D# V. O* f+ m' X % H1 }* @1 l$ H/ w% E0 {* y7 _6 ^5 \
Minimum = 40ms, Maximum = 51ms, Average = 46ms
1 x3 {" e) o9 W
' D; F( [4 G: @1 Y: [0 A 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 4 ]6 e. H- L* y! n" a0 a, s
3 [1 W' e! s$ N. J+ X* I/ x
-l size Send buffer size. ) {! j7 i" U% q4 P: k- H
- d5 B d% b* I1 z% s 定义echo数据包大小。 |
|