|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
) F( \0 ?, Y; `
' _" {! m: q4 Z" H3 B2 F 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 6 d8 D% Z& P& G' V" X
7 y J' ]. ]* P7 c: F9 E4 ^ 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
5 q& Z* n8 `, Z- S& Q9 s % M# m6 m! ~& S5 f; M! V1 L
Options:
' G6 O1 j0 O m5 L
, d$ o' q b) T3 a3 t: N -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 ?. j6 Y1 W* M' G9 |- D ^ $ t0 X0 K/ K# M& t" Q& c
不停的ping地方主机,直到你按下Control-C。 Z5 n" n+ I% u! S% F
) I7 ~, ?; O+ V% t& r3 A 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : p. n+ x; w! J/ r& q! e- M1 a% z
3 ?0 l9 ?( ]6 X, q; c5 ~
-a Resolve addresses to hostnames.
- Q5 }6 l& {7 t* a
2 Y: L9 w4 }' q3 f 解析计算机NetBios名。 ) m; k. o' X6 I1 a9 Y9 e3 X0 Z6 R: i5 v
! S+ h! M; }9 P. U( _% x7 \ 示例:C:\>ping -a 192.168.1.21
2 |1 v; W& h$ M9 N d# h " L$ @; c8 K1 c& y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ! j. y- F- h4 Q1 h& E7 l6 G: A
: a. i4 f1 T5 r7 x9 X* a
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . b5 W* T3 s% A! h
# v3 w0 _; ?# N0 N5 ]- \ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! k* O: y. m. X. K5 h2 p 5 U, D. C; f+ ]6 F8 N0 a+ w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( S, c8 ~2 d2 Y( }1 h+ c( }, Y* T! ~- G
. j" c# D* S" M$ Q6 M( o2 g Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 J- _6 y# Z9 S! Z5 u9 L - T9 K! [- _3 t5 L1 t) D. r
Ping statistics for 192.168.1.21: 8 s- g' h$ y1 z% R# s
- z7 |- p3 Q6 x7 f, d Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 x5 G/ i% b9 y 9 V" A$ e8 V; B4 S
Minimum = 0ms, Maximum = 0ms, Average = 0ms
' b" W: @- O0 D" Y 6 n! I' b- r; X$ S5 T. ?
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 }$ `3 N) v! a f: j* z4 m
, R; O' X3 {5 I
-n count Number of echo requests to send.
9 w3 M: G$ C5 U# ^ * B6 ?* M8 o: c4 T
发送count指定的Echo数据包数。 ! e5 r& Y' q& B: S! \: |/ v
% {( J6 V, R# g; }9 u9 o8 E 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 g) U; K- y. u( f0 s1 A
9 D: V; q) a5 P8 ^' b7 o" w9 k: M
C:\>ping -n 50 202.103.96.68 $ }" N% h! z: q O% C8 }" ^$ a
( Y" i% m& T: t1 s0 ~( }$ Z0 K5 a. A
Pinging 202.103.96.68 with 32 bytes of data: ; Q% z9 w, y ^ J: v9 |& i8 E/ S& _
' i) y/ c* p* K" n! \. |1 M, A: G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 D$ A( \& i* ?5 Q( z4 U5 A 8 W2 N# P5 k. `8 |2 Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# m! m9 H; P& z C3 D% a, {, l' H0 U4 j( S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % W c0 J V3 G3 K J$ L4 i$ o
( S3 f5 E4 @/ U! c/ @
Request timed out. 6 f1 j7 N% p1 d' T7 i* C4 P
9 i. R$ m! U" f) \* R
……………… 2 {8 q1 K2 E0 l( M
) V2 `. s9 `# _; f# [6 f3 Z7 | g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( ^; R+ l9 F0 {+ C+ |9 {
' @, M8 S o1 z* |4 r$ y$ D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) ?. ?6 O& r( g5 z& d8 ?+ ]
# b: }9 x, \; I* x/ p# @ Ping statistics for 202.103.96.68: , g; T6 A+ C6 |0 e& L, q( c
4 h$ {- R' H) B) g- B& r
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 8 V e8 g5 A# [% f* v
" O A( }7 U" A; q5 z( @" m Minimum = 40ms, Maximum = 51ms, Average = 46ms ( f2 `$ f7 J( \' Q% e3 ]) W- T
& v( ~( g# M2 N: o& B
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, A7 J1 l7 P+ d% B+ X
: r" D1 J/ g3 P3 U* W, g -l size Send buffer size.
% O4 d0 }% O5 [+ a 1 x9 g* D- e( a( ^. R9 Q
定义echo数据包大小。 |
|