|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 M: x+ u3 s4 D7 ^, E
5 {% ]" }0 a& X
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 [, N4 Q, @2 F! u3 z9 q
- r% i# p' J1 c: g' 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
* |( b* }+ u/ Q! X/ ?0 h5 o ; z3 g7 t; S, _0 C1 y
Options: 7 u% P; o; A+ s, @ ~
4 W2 l' m$ u8 B. \
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
6 i' f2 T9 v! C ; `( w& [4 V; p* k3 s) c8 a
不停的ping地方主机,直到你按下Control-C。 t9 Q, g d1 c4 a" S6 u
3 m/ S6 p/ r$ ?& q: w, R1 i
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & p( i( I; \" }& v' @: J% N1 V0 e! p
, Z8 ? @( b' e* u: `+ k9 o -a Resolve addresses to hostnames. 7 Y1 w$ J! [9 ]! {, \! k! |3 F @
! a$ Z, ]5 i1 |2 ]$ h 解析计算机NetBios名。 4 }' I: W. W/ V5 O5 M
3 v" `! P1 L; x
示例:C:\>ping -a 192.168.1.21
! Q9 c" Y- h1 \( C8 q# m
$ b: x9 B: O1 x7 ?" {4 N6 u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ c, ]- a$ F8 }" Q& b
2 D& ]; n/ d9 _& i
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . L- r+ j/ r) R; e
2 r+ r5 v- U2 w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' V) y0 Z# R6 i4 \0 o
_: n4 \2 c8 B+ t! O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; Z5 D3 m) {6 G* [
; E- z/ G {0 M6 x0 O9 b& z
- J4 O' I8 ^3 [2 t( P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; K7 ^$ ~; M! D
2 b( V$ E3 S0 B9 f$ u2 X2 T
Ping statistics for 192.168.1.21:
, w+ q1 t" ^" e+ p+ Z ; I- o% ?. {6 w& A
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # B( {8 d }3 `& V- s' m6 A
/ E9 f: C' c9 J4 o
Minimum = 0ms, Maximum = 0ms, Average = 0ms 3 l3 o4 U5 S9 _4 j
* G& J0 D9 L9 Y2 k9 x5 _5 L
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, t- R+ ]% f* f" G- d4 A5 e ) K6 J, _: a1 [+ n8 \
-n count Number of echo requests to send.
9 f+ a$ z5 P" o% b! E! ^; L/ H! y 5 F: F' x1 K' ^; E; Z
发送count指定的Echo数据包数。
' l) j4 _' z" Y
, t, D, b7 ~$ N. [) U2 x/ L$ S 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 i6 j" A7 c1 ?1 ]1 l
+ G4 g) ]7 E8 `( b8 o, e1 D% B C:\>ping -n 50 202.103.96.68
. J8 G& k7 @) N! e
, x8 P4 T/ o! H2 ^+ R1 x Pinging 202.103.96.68 with 32 bytes of data: ' @6 q/ x: J. j* b, N; N/ [
! s% q; |: g6 D* w0 n5 I$ F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) J" l% `5 n4 J3 R9 [- t. W
5 z/ Y% U4 D5 R# g8 ?$ W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 q5 i) m; m T* i) R
& f5 T. K/ U* S# o/ t1 Y9 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " p7 a: C. u% w* z
. k3 `; B4 b& T
Request timed out. / _4 o" e* x* t& t
( |: }$ d" Z: N3 B. C
……………… ' D+ A2 n/ j9 h" V
8 X5 R! W) @7 P0 T2 `1 s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) a4 B5 |" h6 ~" H; S! V$ w9 u
5 i6 x2 ^/ c% T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - |/ D4 h8 S9 P0 P: h7 D
) l: t9 f, E% |! @3 @
Ping statistics for 202.103.96.68: $ P5 e* M2 ]$ G# k, Q# i5 L
0 f: L- ~0 V G8 \( ]9 W* s
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 o6 x. z- ?2 n
$ \5 {, X( K3 C0 @ Minimum = 40ms, Maximum = 51ms, Average = 46ms Q# I6 Z4 z1 `- P9 p3 k1 F% B
: y8 N+ K0 O/ M0 N& I7 G 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : @- J3 n6 M0 X1 T0 Z4 P6 b& i
3 ]/ L. g1 j5 v. K8 q -l size Send buffer size.
* `3 h) L& {4 a 1 H2 Z5 n0 F4 f6 ~
定义echo数据包大小。 |
|