|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
1 e9 s# e' N% Q- J+ _: F/ m& B9 T( U4 z
% ?% P: o; y4 e8 N9 j$ A 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ j; b2 A2 i& a" b, W- l
+ Y1 Z# F5 |* }+ d5 w8 i# m 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 7 g( r1 R) _8 }% i6 g# A6 r: L
8 p1 M% A& F9 v/ \& n6 c
Options:
. W; r, a& j! v) G5 U6 J9 ^0 N $ O' E' i! `+ F
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 c' y5 _- l2 b0 `8 | 7 l$ q6 ]/ `! a( x1 A
不停的ping地方主机,直到你按下Control-C。
( B, c9 w6 }/ o @8 I
& ?& E! V2 ^) ?3 k h 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 M/ [3 N. C+ r
$ \8 J0 K) H9 d% c: f1 ^% y# z& m -a Resolve addresses to hostnames. / w( w# t- W* q0 Z: k4 Z
0 _8 L! P+ Y3 B7 \+ K1 O 解析计算机NetBios名。 ) }3 }" y' B/ f+ F) _7 G( @
, }4 G5 `0 K' Z2 a5 u- { 示例:C:\>ping -a 192.168.1.21 1 @% P* _: I+ V. r# L
1 _7 X$ B. c' f) f% \3 C% A Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 9 j: M" J9 J8 Q( S
6 }% D M2 M" X* {7 \! o% x# m" O0 S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - Q5 P/ l. |, Y% I) ]: m2 @
) @ A) c' r1 j* l+ r0 |6 N! E' J1 L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! M9 |( @& J& t7 e+ I
7 v2 m0 [, o; G; d* C, g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ M9 ?' s! L2 T" Q; i( z
* A6 x3 r6 @6 R0 V8 G
- T& \; ^* T; l* r2 q: }. X Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ }3 m# F& ]* o G+ g6 x4 n4 T
Ping statistics for 192.168.1.21: & x- z- b& _4 D6 @1 Q7 z
) x) H! ?) \. G7 ?" l- ]. ]: A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 S. Y) ?3 s4 S3 V. h4 {
* \1 ~/ w7 V7 N% w, a Minimum = 0ms, Maximum = 0ms, Average = 0ms 8 c. J$ C& E; X% ~! [) T& A) v
9 U2 I# K+ x" E! h" W) l; e. _ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ S/ x$ o' N" b; y
4 ~# M1 d+ `: g! b+ i# ]1 \/ ` -n count Number of echo requests to send.
# ~9 }/ p) x# m& ]2 _, O - f) n ]# p; \) h7 H
发送count指定的Echo数据包数。 4 n2 X4 ~) x" f) ~" E! @' x
/ A) ?( k% ?1 a% W+ M; D+ x& B! ?! M: [; [
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 X$ q$ A" i6 D: T' |0 f & X0 _/ F% N9 g1 I8 D
C:\>ping -n 50 202.103.96.68 6 ~% t4 |+ |3 L& g8 I
, v6 B0 Z. }7 n( u6 y# n Pinging 202.103.96.68 with 32 bytes of data: & Q$ p" W) z2 G8 z& ^" R d- ]
' J Y8 F& N/ p; [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) O% a5 E+ i, s# L" X1 B# G
9 O/ K. \& S# n, K3 G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' H9 U( S5 k; A8 d% V% v' h- X # f/ G) I/ [1 ]/ L' t8 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) o& w9 c$ e2 [7 F0 o+ S
6 P5 I/ L' p# X C# | Request timed out.
" W. Z2 v# r" E& o6 t% A5 f) k ( B4 Q- h% A. |, N2 _5 ^7 y
……………… : T& @4 K) [4 m# o
/ {3 Q8 ]7 ?3 }0 j2 E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; o& w: K! _2 [$ ^6 Z: d
; h! g1 H" F4 T- f- R- O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 d* y5 P2 I" p% h: I
6 ]# ]) f, A/ q; S8 |0 n Ping statistics for 202.103.96.68: 7 Z8 s ~; O0 H9 c2 v6 H! j
9 c+ ?, R2 Q! i w9 _$ U
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 4 e7 D2 L9 h. [* `( m \5 c9 T9 \" |9 R/ Z
9 @! Z: f( V0 r" A! s0 d' c
Minimum = 40ms, Maximum = 51ms, Average = 46ms 6 T9 j- v1 U( l3 C% J# u! C* A
- B7 A- ~, M! o, V- { 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
: J0 O- v8 V$ v5 A# m! l$ V* ?
/ l# R9 z9 j' c1 V' {8 y -l size Send buffer size. / X2 i' G, {* n) ~; G
1 C) x0 k( }. D! f" w, Z; ]
定义echo数据包大小。 |
|