|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 8 H9 m5 k4 Q/ m( y; |
4 [% s, Y6 `- z: Z( g+ s/ r
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& ^% a2 ]* c' }' y
F! t( q/ s0 z 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 3 e8 R9 n8 K4 L3 a8 q
: p3 g% c6 v( j+ r$ ]# w8 b( t# U
Options: - X1 I% ?' x4 Y( ?) b
V: ?( h- {+ a# Q: H4 I
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. + |" ]8 L* b/ D. S) X. t" s
2 O) w6 S' M' S& z5 I' g' L) W 不停的ping地方主机,直到你按下Control-C。 % _, Y" C/ U: o1 H" W2 ]% {
8 z# U% o( @# x
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 `) s8 G6 i9 e, C8 e% Q0 p7 U- M7 G4 ?
( z! x6 _$ H% u -a Resolve addresses to hostnames.
! I- P: }* E0 R) g % e. z Z8 ] Q' e" X
解析计算机NetBios名。
6 o/ D. W0 _0 W& [3 t( n! w
% N( q+ z9 H/ r: e9 D& Q 示例:C:\>ping -a 192.168.1.21 7 x$ I c+ {- v2 h+ ^0 f9 c
) f2 K& j6 t w8 c2 S$ |$ R9 o, F2 |
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
6 a6 A: D* [3 W
0 @1 i$ G5 Z5 w7 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 h4 ~/ V4 H: H( t
7 S a+ k' r. c6 T0 C/ f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% F: Y* |2 C9 A! D
- ~" `* O# t& r3 L: k1 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' f' } \/ h( y% U
# M% e! u" u' u0 ?4 u* S1 M
+ F/ y$ x- O% \! ]: V9 d9 ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 q3 e( o8 j6 P; e5 A; d* U3 W# F" J
; u: Z' c9 B; s" ^% F3 q+ _ Ping statistics for 192.168.1.21: 6 T+ z( i) e! `
& b, D, U5 T( \0 T+ F% O Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 z( q4 T7 P; j& c8 m ' z# h1 E" H5 V: `
Minimum = 0ms, Maximum = 0ms, Average = 0ms
5 Y/ s1 J6 z3 z1 {3 G2 f, L; I9 q/ U
. D$ D, A' R7 m ? 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 c8 t6 d$ @, p6 z
1 M9 j" V# q- b9 V -n count Number of echo requests to send. + ~* K3 s- \0 O0 W( _
0 }: F+ z: f0 s" X& p" u1 m 发送count指定的Echo数据包数。 ' [5 o' w' N4 Q& c7 J
* }8 P9 e9 M7 L+ U' j* G9 n 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 d% M r2 k9 V7 `- V9 a ; j$ Z- s+ S' }/ |+ }3 b- Q
C:\>ping -n 50 202.103.96.68
' \, F7 b# o3 }3 `
* k/ y, u2 m3 y" ]3 V' @3 v' V Pinging 202.103.96.68 with 32 bytes of data: # Q5 c, Z; T# M/ V; ]) c$ X( C
5 Y* u% [; u) T1 v. q0 c0 g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 x. l: D: V) X3 J: x* Z8 w
; Y" s% S/ Q0 T; H4 Q2 n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& `/ {& |* N9 v" ~, P6 d H$ O$ X3 I* Z7 Z( V* t
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& _; [4 B* D- g1 V" J" p
) w# F& u% Z" L k- u# i Request timed out. + K) Q( a; l; l4 M& X3 y0 C
6 w9 z2 y* B! P: w ………………
+ L" I+ R% g8 v/ j
9 i+ G' s) V9 z$ X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 ]9 x* \2 p% L& l8 V, |
9 _% a! W3 s) Q4 T3 P4 D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 Y' L. W+ o3 l/ ]+ g: x! ~ 2 ?; J% [- z3 j, @& o: @ X
Ping statistics for 202.103.96.68: 1 \% P, E1 M8 \
+ r7 O- q, Y: u( f: Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : ]' Q) V/ ^ j" i5 k
3 c" S6 d4 h8 A2 X Minimum = 40ms, Maximum = 51ms, Average = 46ms ; T0 f; H/ P0 k0 |
# H& M! d3 i2 u9 O: z, Z
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" |; @# L" K0 C4 `" C; P
0 y! Q7 u9 T# t* d& @ -l size Send buffer size. 1 d: w$ q5 }7 ~4 o2 U+ P- N% d) _
7 u4 [, i# e% | 定义echo数据包大小。 |
|