|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 X* R8 o2 I% M% Q! U. d8 T
9 x/ {/ s4 y% i" W0 T7 v( B s% u 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
V9 j3 ?/ [5 Y2 f
# J1 i2 W7 w; h4 U& H9 O 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
$ s! ?1 g8 u) ? h, J: H 4 z% U {% ]( }+ ^7 H0 q5 G: `' w/ t$ C1 [
Options: - _+ T& y$ g$ D' P7 w
, V0 @+ l& K3 [, E/ U' U! y: s -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
' V ^/ c" ^! [; k" a- P& j+ r
% c6 p* K: E8 F" z. ] 不停的ping地方主机,直到你按下Control-C。 ; X& r3 |+ U1 [/ J; I% t( g' ^
* `' `- i4 S3 e% t
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 7 `# q8 Q, D. U8 I O
/ y% i# X9 T ?" m F
-a Resolve addresses to hostnames. ( j" Y1 o; z8 K( u% Q8 u7 ^
* a1 ` |! c4 a9 E 解析计算机NetBios名。 & H# n; h4 S' n$ v. U* w
, l* C0 X: z, {$ D h 示例:C:\>ping -a 192.168.1.21
0 S# r0 T) t& {) B: }4 Y$ V 7 j1 o% ]: ~4 i* @0 y& l6 d/ k
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 j( ^/ m- u1 y3 I# h% f5 S
* m0 [6 d) A/ Y0 z& b& w1 O, a& H! R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ ]7 T- Q8 O% O; z 8 ]# \- I. A: A3 W) ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 n3 O, t. w5 f4 T$ P 5 e6 x4 j- q0 e% e) R" V" @( P" }
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 b7 J; j7 b, B2 ]
& r) n4 d- {3 [+ k7 p; c3 p
! B3 ]' q/ c) h- v7 H Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; L: M& G' P3 ?# K
3 t2 X" Q* K3 _ Ping statistics for 192.168.1.21: 3 V, i- U2 W3 {8 r
" E4 E) ?8 M" F7 w. @1 y$ O Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
1 z8 g6 t$ L: v: ], c 0 ]+ K0 k7 k/ x' h
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- ?- I% N4 h4 l1 i+ E. M' H
7 w. }1 O( u$ P6 o" A 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * r: e7 @5 K: b- U) H
) C# P" d* ~. b; O2 _
-n count Number of echo requests to send.
) r$ i8 l2 ?( y* l
: s6 ?# b5 M1 R1 ^ 发送count指定的Echo数据包数。 + T: ]6 e6 S+ }0 z, b
3 S; \* x d& n4 n9 E* R 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - m) K# L$ H; m
b/ ~4 W5 L0 ^ o& h' f
C:\>ping -n 50 202.103.96.68
( b: ^" [. G3 H* ~
$ ~! ~7 Y; C1 v Pinging 202.103.96.68 with 32 bytes of data:
o: `0 q) W/ D
! R9 X# O. n* n- W/ i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % y; s' A* ^5 N8 D. C' W% N4 j6 x
- L _2 Z M0 S% z/ B3 M% T! D" F7 ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) j& C; s* Z" o( w+ q9 B
w/ {/ j/ d- P( e Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : v& R* g, K* H* Y. R" U
+ m8 }; h2 `- i' s- ]7 ]6 u5 ^7 F
Request timed out. 0 e/ G. R' n% E
2 d( ~4 v2 T& e
……………… ! X2 P# K8 N! O% I6 K7 F6 h
3 R6 X8 d4 g/ m1 W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: v9 d, O# U3 r/ R' q " w5 h* _. `: v- c$ {, C- F' i7 \* n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 R! P# z* C4 s! l' r * a: S# ~' O9 K3 U9 C) J1 @
Ping statistics for 202.103.96.68:
2 M, W; N" C/ R% i) e ; P( C! m. h, h
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : e& H9 {( a, k% x; A# g
: O: n7 _) L& G3 m( Q/ K/ r
Minimum = 40ms, Maximum = 51ms, Average = 46ms
% M: y/ B3 n, v b7 h- W2 n . e9 S. @3 D. [' {% a$ d' `' N
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 , i; M+ ?/ `4 T+ G% _
# U3 C! ]* I1 C" d -l size Send buffer size. + {5 ]% ]3 i: K. u% O. l% p
! k) ^3 g7 b" r' v' T2 }6 h$ [
定义echo数据包大小。 |
|