|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 2 G `9 s+ P) a# [; V
/ N V: T$ _8 T7 T7 Q4 b f 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
0 o7 B) H! P- X, o3 o w4 T6 W( r+ D: D! u8 J
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 , X0 y. G% g. Z. b9 y( v% H
, `2 d) l/ t2 L0 f( O Options: ( n( Y% b9 k, O9 W+ R' h
6 ^7 [( l; v: g8 B X
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# o; _8 |3 S& g% x8 c) D& Z ' C! P6 t5 _$ u: w: v: G2 q. t
不停的ping地方主机,直到你按下Control-C。 2 a: O2 Y, t+ P2 z7 |4 D3 D
# @- g8 X! p3 }4 ]7 v1 d/ m$ e5 i i9 m
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 7 m3 T& x3 R/ d( [ G
8 U5 k0 y8 I |: z; ^
-a Resolve addresses to hostnames.
! ^. I- [3 U6 K' H* w( T( Y) R
1 t1 q1 r6 d# g( j 解析计算机NetBios名。 6 ^* Y. X& P& c6 h9 g8 f
# R: R, X& C. E7 K: z/ \
示例:C:\>ping -a 192.168.1.21
( H4 p" Z0 L) w - m. ?( [; L! k$ q% o
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 Y( l" }5 \$ y# y
. s3 K2 U1 j8 |- @, @2 o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ I9 w) x( v3 z
# P1 v; M, r7 N& f1 `. ~+ K
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! k. {$ O' l: X: z* G7 d( e ; M+ U% q, K7 g/ s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 H- [4 s |+ }) w9 `
6 X! Z. U R2 v4 c7 u& _4 N
2 Y$ v4 x5 i) J+ F" M0 z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , S: W3 h+ L# S# G" o! N
5 n+ H/ \- k) Y* b Ping statistics for 192.168.1.21: & N. i( V) G: }& S& M: Z, L
! r% w. j7 ~4 p6 f9 _4 e( S
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 e; I$ q. B. p5 e. J/ M$ g3 ?
% D V3 S8 P& T Minimum = 0ms, Maximum = 0ms, Average = 0ms $ h$ R& u0 E2 y
. ^2 n, I4 q7 D: n; t
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 9 N; b( t; W$ y) v/ T4 A' q1 P! E
" b' f% h$ R% N4 h* ^( d; i8 T
-n count Number of echo requests to send.
4 }+ g1 V7 e) m% A9 m
2 X, R& q1 D) t7 o# } 发送count指定的Echo数据包数。 & C4 N0 l3 t+ ?9 |+ o7 n
T% i1 d- ^7 j7 R& c
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- l# l: Y8 M. t6 p \
; p. _6 q) W' t& q" x! o C:\>ping -n 50 202.103.96.68
_8 k! q# E% L7 w8 g# Z
0 p# G4 U. d- w3 J( u; h1 k Pinging 202.103.96.68 with 32 bytes of data: 6 ]5 m8 p& o' t$ Z' t# a
" z+ n3 S. l5 F4 F, [) c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: l% R4 E9 o' y( y E7 [- b
( q& C) F1 l; k2 d ?* G5 _5 x% V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 z/ g$ S4 h A K! ~& D; y
0 k6 r% B! l4 U4 F B, d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 H4 y* W% H1 d
% k, c/ m. {% C Request timed out. 6 n5 G, h, Z/ @( Y7 Y& x
* J% |) w M1 W4 j ………………
7 m5 X+ b1 G) f# q6 ]
( V K5 X$ }$ B8 e5 Z6 n% { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# L. D. x1 m' x. L/ Z
, y0 l4 U& t; I' b( h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " W6 ?, ]6 |6 |+ O8 h; X. i/ r+ |
+ Z# y0 G6 T. U# _ Ping statistics for 202.103.96.68: 1 c$ I2 V. f, C# T6 o+ s/ `
8 t5 ?. {2 X3 d, a0 k0 Z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
5 y6 a; T# h9 y$ Q # [" l! z2 r7 C7 r
Minimum = 40ms, Maximum = 51ms, Average = 46ms
0 M4 A: x- h/ `+ Y% e7 U
3 a, O* ^1 S+ R 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 k4 t& v4 s' v 6 m& u- w: B; F$ p
-l size Send buffer size.
% P6 e: P2 Y+ Q6 b5 o: k& h
" n6 i; }/ \' Q9 K7 n' C. u 定义echo数据包大小。 |
|