|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ; G; x3 r( z6 S5 V" {# Q" I
2 m4 v: n6 B# ]0 P/ k 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( ~: F2 u% S' c& ]; n 9 w# B9 |4 @6 @9 ?1 ]% q
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 ! V' D8 K' a/ d
6 i. m# M) m" s4 A# S" @" ~7 ^
Options:
& F6 Y5 N) B. J3 p: }
! o) _ H7 Z" W7 R+ H" J7 M" c -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , Z: G) q+ u4 W8 Z5 ^7 {; L+ W
/ y& o6 m: Q' F" |
不停的ping地方主机,直到你按下Control-C。
& G9 |6 ~9 |% E9 F+ I% W ^7 z" x, ^0 X# m* Y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : f. b+ S" g; f7 G: h
; ?& `0 s8 l5 }, N
-a Resolve addresses to hostnames.
' a4 m+ Y# u! f8 Q2 D- r. Z6 o
- c9 H& D: f6 }/ u8 v+ M8 y6 Z, c 解析计算机NetBios名。
: I+ O( v! A' Y8 j) @/ ] ( `7 k& R' P1 }& ^% l3 B1 K
示例:C:\>ping -a 192.168.1.21 6 Q# f [( g) w* p
6 a) @3 @3 v$ {% s! M; e+ }5 { Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 x% q0 M' M3 K- }+ c; `9 W d
* N: ?- A4 l3 l6 ~8 h& t( x; z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
X9 S, W: z3 o- ~/ v7 b# c$ g6 c : g- `; G. z7 K1 M% m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 E3 q6 N# f8 z9 O% p
( u" t( I y3 P& z$ W, Q; ^/ k2 m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , M0 p+ J" K2 g
; N* U+ c8 M* F5 ~4 z
5 h" N( {/ S5 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: x- H( H! p5 s: f" P* \ 9 X3 S$ H1 ?. P! m7 I4 j6 y
Ping statistics for 192.168.1.21: 5 S) b4 S) A) c6 I3 n U7 S+ [
, g! \1 o' Y5 L* b Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: & l. w7 A# U6 ]8 ?7 u
7 f9 P/ K6 f6 j T
Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ Y1 K6 q1 C/ y* \2 _% G* s0 M$ {
( T' \. J0 Z% J Z# \ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ r5 W9 l4 _4 I+ X, k4 r4 G 8 d+ Y+ S- |/ ^. l9 t/ P
-n count Number of echo requests to send. 3 g3 s$ u# g1 g" r' n
, X7 V9 Y8 q- z
发送count指定的Echo数据包数。 ' h3 R1 N( a# Y c
9 B1 m+ f2 }+ ~7 T! b: q
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: : N( h; A E$ E7 P9 }
, [" I: l! m" w! L+ n8 l5 f
C:\>ping -n 50 202.103.96.68
4 `0 f* h* ?) O0 V 7 l. m0 r+ o; J3 Y ~& `& k N/ K- R
Pinging 202.103.96.68 with 32 bytes of data:
8 ]7 m5 f4 z: |9 t( U* f 0 | |* K* p8 N/ C7 C+ e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , X6 {7 \, `9 K% i
& H3 W8 A- w s& j* E2 h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' L) U- V6 I% |3 K
- e( f2 R) P5 I( P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 F0 \" Q. X* Y+ i0 S" h * h3 L# B$ P: l. e; W
Request timed out.
1 f0 g4 h5 P1 f9 x. B6 W4 a4 U
$ f. k. M- \3 X7 d ……………… 6 p; p! I. l+ H0 a1 w
" ^" e z( W8 M& c" `4 ^- f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 ~* ^9 h* n) f7 B# l0 {
% h, }# |3 o* @- K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % x( f* q) U# i1 S, C
& p6 d3 a9 B& y ?+ Z Ping statistics for 202.103.96.68: & I. P% e9 v& f# s' V- p: C/ q
8 R0 \* r9 \" Y5 z& R& { Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( Y7 U" F m- d6 F6 D$ M" N
3 a6 ]1 Y" c0 [2 W) @6 L' z5 `- t Minimum = 40ms, Maximum = 51ms, Average = 46ms
) ]% x6 y( U3 K8 H, O$ t
# X/ X/ v5 e. {2 z 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 w* L/ G4 N# s, x- n 2 H( Z* Z: A, Q& \- C( `# @
-l size Send buffer size. * i5 W( X; |3 N4 G
0 B5 O" E3 G2 ~/ I 定义echo数据包大小。 |
|