|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
* |# c. S+ o* C2 ^# h
3 H/ L$ j# l2 h4 i/ W# T 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 i: ]: ~8 @- L2 q
# l, U l8 x' ]" h' F! }; Z) z% S" 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 , z: f' i3 V+ C- |0 z9 Y R9 D$ R
( {/ F& t4 c+ p- }% E
Options:
, s c* F! o1 n/ w c X' i) T3 Y! |# B; x8 c
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
' `+ [; j5 m& q . Z* S. ?2 A* T" i, q+ M6 Z
不停的ping地方主机,直到你按下Control-C。 : C, z4 P, s( @% v
: w, s! a( o2 a: c# N5 _
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
% ^5 t* v8 T" K ( ^& u3 A6 M% }4 R3 T7 p8 W
-a Resolve addresses to hostnames.
6 B2 B$ I. V% f7 }, h6 A
! b7 K9 r1 ]; [' g, { 解析计算机NetBios名。 . [4 ?1 p4 P" Q# o& _
1 S0 h: _7 O( @! y) ~( o( ^4 | 示例:C:\>ping -a 192.168.1.21
x6 g5 f, q _( Y 7 G9 x) h- o. a$ U. h
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # I, U* a9 R) E" a+ ?7 H7 Z
' u8 \: Z( ^3 h6 O) T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 M; L% _; P8 x7 ?8 T5 W4 @
# M4 z3 Y8 _0 _8 w, x; t% c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) L/ `6 M1 M, P% P, J( ?9 w7 | % o( `" t& w( K/ L* W2 [# B
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: L1 M4 s9 l) X* ~# M! ?3 G0 b
& P0 X# G; P; o# h0 T5 G& M7 p ( r$ |' f8 \6 f. e7 s3 w" B
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # Y# F- m* E; K; S1 t6 s0 H
) `, b8 e8 `2 z, S, l0 `: M
Ping statistics for 192.168.1.21:
9 N$ S L5 C8 ]9 k' w0 l# V" j; ? / z+ B/ B1 e% S5 @
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 m( t5 y; A# y! j. T
6 ]6 {( C5 E9 U8 l# F( ?* y Minimum = 0ms, Maximum = 0ms, Average = 0ms
7 i0 y6 i9 k3 u ( ?& ` Y" }: s9 U4 `/ \
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 o) V$ r! @6 b: M0 b- F- f ) }2 ~/ b$ A( V) U5 j
-n count Number of echo requests to send. 4 n& K+ y% N2 t: t
, C/ C0 X8 n) A1 |1 i) X
发送count指定的Echo数据包数。
& m/ Q; t* f; u: N
9 e% @) T; i7 d c0 h% n, c8 u. C 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: : }, J; y( H' G6 E
) @, T2 \& w# M C:\>ping -n 50 202.103.96.68 6 V. h* d! |7 d. h
- j/ p1 j1 ^5 S3 m; B6 Z
Pinging 202.103.96.68 with 32 bytes of data: ( N+ _/ S3 \: {1 A0 H# K7 {
) w0 p3 ^( }/ f& `2 c/ n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' q" Z, f1 F4 q$ X S$ D, _
, P2 l& \4 R" ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , ~; B. L7 L$ l: O
: J' `* I8 D- K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' x, z& f! ^( U/ `( o+ n
& X# e# `% @1 {, ~) K7 l- b. ~ Request timed out. : n7 l! a' T) Y* R
' y: ?6 l+ f4 ]
……………… / l+ e' l( W) o6 P) ]
( D5 Y# _1 n4 \! J1 w! M+ l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! q+ c& l$ P: P4 i! ?; M, q3 H
- j$ B+ d1 A9 t+ t6 V5 Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 X( S( o0 k- u$ c/ w! i- r1 y" ^
- q& [9 }1 ^5 t7 U$ O" s Ping statistics for 202.103.96.68:
2 `' U! m: A% O+ V: x; A- F' L$ O. n , c; I {3 ^: \$ u" N3 I; ?* B
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 8 I# _) I' S4 q d. R
2 I \1 i; n# C) r# P: a5 K/ F Minimum = 40ms, Maximum = 51ms, Average = 46ms & j X. {- |: A* z1 b3 ]/ Q
& B6 u* B, y* l9 h( ~ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
# o% q% @! Y+ B; d; F 4 t* g5 O, Y. w. ~! ^3 n
-l size Send buffer size. ! j6 d4 ]0 s& x8 x W6 C
1 C" o6 Y2 ]/ C9 |5 }8 [2 v' X r* f 定义echo数据包大小。 |
|