|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ y- Y1 P/ r. N& \1 f
7 D# h- B1 n! `1 b$ { l 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 J# h s k$ \, v3 x6 k
) R0 S. r$ H6 ~0 ~0 h3 n 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 ) y( b, @! _3 t
, o$ T/ o4 S& u1 \" k
Options:
2 V8 M' e" e, n5 _0 W9 s 7 j7 z. P. M9 m* t# R1 Y2 `2 P
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 D: {2 S& M- j# A& [( j7 r' k
" s5 U; t. Y( K. M& v+ _
不停的ping地方主机,直到你按下Control-C。 8 D; S, z: U g7 I. t) Z4 B
q; B5 t' }. p6 z 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 % G3 y `/ u# c$ R
+ _* w! P% F7 T$ Z
-a Resolve addresses to hostnames.
. u. Y4 F B, U* B' h" E) B
0 r5 W8 ^ z5 s7 T! L' U% Q 解析计算机NetBios名。
" u" [% r7 K: R! j/ o: _" W
; J6 Y- U K1 c! B5 O2 {7 U 示例:C:\>ping -a 192.168.1.21
9 ?, D T/ a% c, | 4 X& d6 _% q( p1 m; Z0 J
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
+ Q. u# S) R9 ] 7 m8 }3 j# g& B, a
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( i" H P0 X' S: z9 @; w) i
! E1 T! ?( [9 j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " i8 t+ g+ o+ T# d9 o
, Y5 e* R* Y2 A/ b; d* Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 z9 @9 ~# K+ |# @$ m* ]9 O# \/ e
2 t3 Z# u7 l* }9 [* H/ v) r7 o$ v
0 h3 `/ v9 B- U0 |/ D8 Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' i$ V. G% S, M- U" u @4 O! B6 Q2 @; `3 Q
Ping statistics for 192.168.1.21:
' }8 \; W8 n* j0 F4 ?! ~3 H5 W 5 y/ t0 x# D: { s
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % s9 i+ ]+ J+ Q. X1 b, J) Y
$ f& v1 }. |4 c; a Minimum = 0ms, Maximum = 0ms, Average = 0ms 4 d' I9 i# S( i, h( T
- f4 C, W# a# B2 }% n) t
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
1 t5 F7 \2 }& S3 x4 f2 f7 m
5 P6 _- Y. [1 ]3 G -n count Number of echo requests to send.
, O4 y5 p, ^4 z) S& `0 a* ~- T4 G * _3 s# j. v7 Z
发送count指定的Echo数据包数。 0 {5 y$ p: W1 l( o0 S; H
- @$ f9 ]. W; r* _/ f4 F
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
, ~( J& |1 ^1 ^% @ * |! g* I- C. ?* ^" g0 Z* i& m
C:\>ping -n 50 202.103.96.68
5 t; \+ ~' t, R) \& y9 h6 b6 W2 @8 d
) b; V0 M4 W$ {/ V- G/ v* X; m; o Pinging 202.103.96.68 with 32 bytes of data: 2 {* q' @% e f: B, c6 ]( B
2 C1 _( ~( g# _5 ~+ C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ g; B* t/ }2 T V9 z
5 @0 x8 e; B. r% q) t5 @8 P: h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( y" q+ @3 M6 G; t: Z+ A5 c
9 u9 ?9 P/ f- o+ Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! a @/ W+ t$ e( {4 X % E+ W7 q6 s& K" ^. I
Request timed out. ; w: |1 f: `" F* ]% {
9 y6 b, u5 V- D- e
………………
3 S) m [( T, y$ L" b! U/ S( f 6 [# F# z- { }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( M# c/ r8 b+ N/ G, [
4 r k0 e5 h4 K J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& q# y) ?8 H2 h, g6 [- o& w1 s ! D- }6 {! }! |9 D& _9 }+ O4 d
Ping statistics for 202.103.96.68:
3 C+ |3 `- H B. \7 I, t; z
& l: c4 T# h) z0 V Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. E% [6 B$ L0 _9 d
4 U* G) n; p# ], \4 i2 B! D+ ~ Minimum = 40ms, Maximum = 51ms, Average = 46ms ( N! `2 `# g. M ^/ m ~
: P1 s [2 a( M* N& l1 \2 N9 E
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
! N$ X. c" x7 d$ f0 q8 d% [
2 s" R& p+ X+ U/ P -l size Send buffer size. % u+ D9 w6 C# U7 [4 x
3 W1 r, d5 f/ @) l/ P 定义echo数据包大小。 |
|