|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * c2 x3 K R C0 \ {
) L! v& t" O; }, n1 L5 \0 W! e7 T1 ? 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# Y }6 v0 U8 W5 }& J8 p
) r- K& l( \9 ^ 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 C' \0 C& l/ w1 s% u9 D" c5 N
7 y2 S( i: w, u4 t5 r$ W; A+ g
Options: $ w: h' d0 K$ g2 B B
! S/ F9 F# A, K" w3 e
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
, c: B' H3 ]8 w5 y1 o 4 a; a: s& }+ L* x4 q1 k
不停的ping地方主机,直到你按下Control-C。
& u" _. P. a' l7 t( S! k- g 5 K4 I& n, Y. e0 m
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 W2 E2 b9 a t2 q4 @" E 9 i9 c4 `; e! F7 q$ b7 J
-a Resolve addresses to hostnames.
1 l' R# ]) E/ ~) Z* ]3 o6 n( N & @. j- t$ J; l3 ]: o
解析计算机NetBios名。
: j0 X8 p2 L2 h9 g. p5 x6 v4 t# F% I" v
- }5 q3 v3 ?0 `8 E& ^( \$ ]7 A 示例:C:\>ping -a 192.168.1.21
) o. X8 Y) a. _" B
7 l4 Z5 O# B; f+ n% k+ l) c' u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ! s/ y5 K4 `# g: V7 R4 z
3 z; D6 U5 C4 T" F
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' [& Q4 _$ `( i8 Q. T2 M4 |
4 a3 M1 ^* ?! f9 O; e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 A8 H3 C7 e: |2 ]% t8 i
9 W' [1 e% X; T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 o) [/ v% [2 \" }/ n" I
$ \+ m3 | O8 Q2 I: ^" @0 p
. X+ U& ^1 _% `- L6 { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * z" |$ A( i" f- Q5 G8 I) Z5 b
) y1 P1 x# A4 [7 j& g2 {
Ping statistics for 192.168.1.21:
% [' ]" o* u1 X9 B3 T. r
6 q2 {* r/ v5 d A5 X Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( i4 u+ r0 H, E. p# @
: J. Q5 r7 f0 @+ j' { Minimum = 0ms, Maximum = 0ms, Average = 0ms
$ S- P5 X" n2 |& {$ t' k5 W
) l" K3 s E- ]9 R3 c; [+ C 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 V4 R4 J" X- J7 `4 s
" q6 F6 ~- N) v -n count Number of echo requests to send.
! J9 v5 P/ z$ ] . c7 b/ }3 a6 c2 |" U
发送count指定的Echo数据包数。
0 T# ^: O4 _4 l8 n8 h; J# a
: A n4 M* C0 A- J% P& D+ j) b 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
# S3 \' ]8 R g0 [" h5 C" f
7 y$ I' T; F6 O! i2 }" @7 ^# y! K, k C:\>ping -n 50 202.103.96.68
8 \' Z% D$ K; V4 L. d' s# d
6 N9 \, P. S+ q, u Pinging 202.103.96.68 with 32 bytes of data: : s$ _5 A- E. l
6 b4 U' C C' y/ P* \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# e4 C" {. w% y3 I . b) K( w4 r3 A' o# v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' Y+ l0 C8 b' l' ]" j* i X/ B
5 q7 D9 m( d C# d: a1 ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + h2 @" E. R# W4 B# J' [
* T" ^9 o% j& r. l' X: ?1 c
Request timed out. ' k2 \& i) |/ w/ W7 g+ E8 b
' z6 e6 Z/ P% E2 r, @3 l5 L' H ………………
. a7 {- `( {& g0 B& Y9 f: k$ d* h D" I6 W4 O& h. V1 |. I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. C7 x' C3 l3 _0 H# G 8 M4 {: P) C0 ^" @' V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
f# X6 H* @$ n' E( P9 F / p% T/ Q' ?9 b% |; l
Ping statistics for 202.103.96.68: * v7 [9 |, @% U; F/ a$ S6 o- m5 x
- F" ?) N' v l0 ~
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. ` I& u2 W7 @5 E1 N$ {) F
8 P$ I4 g# R# T6 u Minimum = 40ms, Maximum = 51ms, Average = 46ms
. d r6 e6 _" t% t$ Y5 X1 S+ l
/ Z: r2 p1 g/ [# I$ E. k9 [! | 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 P2 _" }8 P1 N* H# S
9 X. q7 V8 n: g
-l size Send buffer size. . H5 X/ I: I" E3 T1 C5 m
X9 f9 ^1 J: W9 q+ b
定义echo数据包大小。 |
|