|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ( z9 I; W& m: [) i( k G- T4 P) S) [
2 w+ p7 J0 ] Z5 V) L7 d
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 8 ?; i+ w' E8 V6 D5 K% x
* O- U O/ {* 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
6 ~8 g \& w/ A0 s: e* c 0 t: U6 @4 \" Z+ i
Options: ! R, t* G6 {2 s$ M+ e
3 K. U: E) z$ s$ j4 E6 S -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ! w8 \( ~2 ~8 _
0 L0 X0 m9 f' S* O! s6 A% {
不停的ping地方主机,直到你按下Control-C。 $ ]0 c% s% @2 c
4 |$ n$ T7 J2 r6 S% a
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ! h% B y/ w* k( T7 c
2 R, @3 ]2 z9 C. Z; M o3 A9 B4 \ -a Resolve addresses to hostnames.
9 S2 r0 K, x" w# T0 B i
4 ]) q8 {" d" [/ ~ 解析计算机NetBios名。
V4 S9 t8 ~& p/ k
) s }7 l9 q5 I 示例:C:\>ping -a 192.168.1.21 6 }8 Z! Z- G3 Y3 a
, F, G2 d$ T6 h9 m: ]) ^
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( b0 W& p& j8 {
# ]/ u' b" q* z2 V) `# Q7 Z$ j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 v4 Y( G' } }- r0 `/ j3 m % n4 |/ Y2 j, Y. e( g0 D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - v3 b! O' w: F7 O$ d# v4 q; r
4 g! s5 H( h2 a b* I2 G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 B9 r/ {* ?8 f, t
2 q1 r- \' }9 y7 p5 g9 s6 d7 c
; E; W7 i; C$ `7 S g$ l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 s( N8 m9 ?2 a8 Q1 k& A
) o! D8 q. f2 L' K. r8 ]2 t Ping statistics for 192.168.1.21:
; U% g: P Z4 H0 ] 2 t$ P& O! m1 G3 K! a; }- Z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / u" |7 \4 @, s" Q! C/ i2 x# g9 U. L
; e; m/ }6 L1 H& j$ ~
Minimum = 0ms, Maximum = 0ms, Average = 0ms ; [ t7 j0 q. Y/ p$ R
8 q3 q' N1 K; ? 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . C, }& h- c1 n. @
- L; p: h' `/ n
-n count Number of echo requests to send. % n( V, e+ T3 A& q7 F6 r' |
8 n7 }$ i7 h) {4 ^ 发送count指定的Echo数据包数。
1 n, d0 K, M9 n 1 F( |+ Q* d8 I5 f/ Z& W
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
" b) Z& @# m/ K J , V( J# P- d4 ~2 ^! }1 A& E
C:\>ping -n 50 202.103.96.68 5 Q' O" W4 I# t* d& {, C# V
2 a% W$ v; S5 e8 k; V5 z% F$ U' a
Pinging 202.103.96.68 with 32 bytes of data:
- y4 w. X7 ^/ q2 @& D* Q4 x2 a
5 g; x$ f: o" W9 D4 L; _, v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: ~9 V: o {0 ?; _1 a
9 J% c7 o; X; J. f' @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' F3 n% K# t9 e; `. p 4 p! l$ k% ]& Q3 \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * Z* s2 v+ x. p
1 ]8 P8 z' r7 r, N) A Request timed out.
( q# E1 x+ i$ I R* r $ P q' i5 x2 D2 D# n
……………… 2 l. I8 z6 m0 c, |2 O5 i
2 [! j! K, j/ s! }4 A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - ^4 y: O1 M {6 e9 l; n) r4 o
7 c1 u7 \6 i1 v0 A& ^4 X: V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) |& X% M1 _1 r9 [
) Y3 }! e8 i. ^, c! a
Ping statistics for 202.103.96.68:
7 [3 P7 p- A2 B- m; `2 F
4 N A- d& P4 b8 E0 {0 e Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # }2 x0 r$ w( E% @" v5 Q1 |6 D
* `, Z0 S7 B: Z5 B& r Minimum = 40ms, Maximum = 51ms, Average = 46ms
) b$ B( e2 I6 g; W" M. D! l4 z& Q
* g0 q/ [8 l3 N: x( a 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
+ D' ]! W9 Y/ U# O. e' A+ W* N
1 C, N- O! o: |& i* G% [ -l size Send buffer size.
# @7 f7 A9 D, }0 s, h ( {( L* {4 W7 W% _3 ]' c
定义echo数据包大小。 |
|