|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 . p/ ~, E5 w' I
% Y0 V' |, u$ w- K
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 5 G+ {1 i" K$ g2 X
. }6 n( q6 a `6 @# x$ _7 w7 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
+ G1 ^. M/ `6 \* p4 T" y0 g
4 i& E+ o2 l: a Options: - I% v2 v- o9 S$ _
2 ^* w) C1 r" Z, S% D. w" j: t/ K
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 [. U8 C- V4 o# e$ I
! v3 l4 C, u5 r0 _
不停的ping地方主机,直到你按下Control-C。 * T X, h/ S" f! h
8 F6 K3 {% O% z+ o9 V% L' c 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
- k8 t* _+ l k" Y 9 U) a! `. n7 e0 d4 |# R
-a Resolve addresses to hostnames.
: f; E- n A6 V! N
\/ v6 ` v+ m8 L b. v( N 解析计算机NetBios名。
6 Y+ H% Y) z) z5 k7 E1 D
- D/ `* N: U9 d; }- H- V) z 示例:C:\>ping -a 192.168.1.21
5 L8 }& ^+ j# @5 G" i* a8 k; Q5 }
3 I, c3 t/ C6 d' M( h1 s, R Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % {; x1 Y& q) Z" V8 G+ `# r
( Y0 R+ J7 |. P1 o# ^ d( M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 X# F* u$ m' ?, e0 |
/ j3 x; C) b( y( | Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + S6 z" s( _* @% v1 S! j: U
+ n1 A2 M" V/ s! p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) S F) `' N6 g6 b; p T' f- F7 N6 _- }) u
! M& Z" p& S) c1 b' |8 ^+ D, y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; }6 ~( `2 \; w8 @/ {
- f: Q* q4 t" F' \( l* o; H Ping statistics for 192.168.1.21:
) y5 w0 ^8 h1 n; d ) p3 ^& B2 @1 a: E: x5 K6 w$ K* ^
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + ` P- z6 m. r8 O1 J
: h' o0 ^; K; o% i) \
Minimum = 0ms, Maximum = 0ms, Average = 0ms
" a' ]# u5 e* {# y
0 e5 p1 r. c n1 W% X 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 w1 m2 m$ J7 v
0 l6 X: Y `1 C" A+ \ -n count Number of echo requests to send. 4 h* p6 I& o! K. q9 M
( t& F" w0 S3 e4 K0 X0 U
发送count指定的Echo数据包数。
( s5 c8 A# Z+ V' K! W ' r3 H! B. E5 L! @
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% P% C! m& U$ ?: Q4 ` - K" K6 t, t. \' O3 n _
C:\>ping -n 50 202.103.96.68 G& Q6 M+ O8 A3 d, A
* u0 l1 b2 n0 k- G
Pinging 202.103.96.68 with 32 bytes of data: 2 ~5 h7 s5 m x6 f1 G+ d& T
; x& x! H" d/ y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ v! Z4 L+ W$ j5 w ; o; @+ ?* V& Z" E, m' R; d( l9 s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( K: T6 w# Y% M" k; G+ j % s' [/ N0 Q5 ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 I y# p" |% ^" h
l: }* s; s8 o5 M+ M' t* n- { Request timed out. % q3 `3 _$ z4 V! M- ]* e6 X# h
4 t1 a9 p' K `8 p* C' W. p0 R
……………… ; o( R W$ G2 b/ c0 F
y. u$ d: E& `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : y* s N2 ?* F9 J. A) {
- ^4 e: z( e; Q6 k: T5 F9 L' a! }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' q1 d. E |: r( E6 a" F2 o* ]
# g2 x' x& h) E+ w+ G2 ^+ S$ T9 l e
Ping statistics for 202.103.96.68:
; `, i/ v& x. O9 q0 c8 |
/ V: G% _# [# A/ h Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. i- B% U/ _0 v: }/ ^ ( t* d4 d8 R$ \
Minimum = 40ms, Maximum = 51ms, Average = 46ms
0 @- ?$ V# N; _5 @7 z! ~ 9 C8 l$ n& V! F8 p
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( l' |7 C& b" i; ~# j% X7 _8 Z
% }( q& w- w! Y -l size Send buffer size. % x+ k5 g) C+ U% n. M9 \. X
' A+ I% C1 q1 F$ e# A 定义echo数据包大小。 |
|