|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
& [8 P" Z& d2 k! i/ f
4 E1 V9 K3 o0 p* m! E% u6 H6 g 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
' i4 `" l- n+ p
' o* N2 D/ w, b% ?7 |) J0 [ 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 3 g% y4 ?7 _6 [* ] ~
# ^3 \& k5 l3 \7 T Options: $ \/ o* j% N& @2 p+ d( e
4 U0 s4 y5 {5 l0 {- ] -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# h1 a7 f- m6 @/ L# \
0 Y# j# p% E9 J2 n 不停的ping地方主机,直到你按下Control-C。
+ i3 n. W) b' N9 {& v! V+ _. N 3 Y3 E# q7 H( |+ {9 E/ q
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 - u3 Z# B% T/ R. F, \3 ~
% _* Y) z. L9 ^ -a Resolve addresses to hostnames.
- l: E/ C3 |! ]; [. ?$ `
x( z# R2 M6 t, M1 `/ L/ n 解析计算机NetBios名。
) v8 d* ~! D& V. F/ T ) o& T9 S! u/ q+ S" p: \
示例:C:\>ping -a 192.168.1.21 1 ~/ ]# n$ x u# c3 W0 h! T3 s
9 y- B! {$ q( P' x: F% Z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* F* ^0 A1 [& V# h i o Z# S9 K9 R5 b. M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ t' K" ^8 H; x9 }. f8 l6 ?0 c. _
5 o$ D4 d/ G+ I v" x$ a
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: [9 y+ H, d; P) l9 A
* V2 A6 I' V" T3 M: \ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ j+ u4 Z- P+ K5 r9 A' Z
2 e9 |# A- `* O* e6 O& g5 v
- {- w: N! Q: o8 P, g( { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 P* I8 q+ }; p; P% ]) D- e3 z$ [
" |* X" n; I7 G4 D9 U% z Ping statistics for 192.168.1.21:
6 }5 J Y! }0 t+ ]5 j + w/ q! y( |9 R' a3 b, Z. _4 o
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
& w) s+ K7 a+ a' I+ V* p ) R, {0 E* y) l3 b+ @5 B- `2 H- l
Minimum = 0ms, Maximum = 0ms, Average = 0ms 7 t) G8 K5 `; P+ C* V9 v
" e9 ^7 Z# O, y( w$ l, n3 Z
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 0 c6 c* S2 z8 R2 b- w& x
' i0 L' R, @, l- m4 n( d -n count Number of echo requests to send.
7 [4 V" C; [) l, M$ I$ S ( p" M. W3 J3 w$ L6 Z# p2 ?
发送count指定的Echo数据包数。 ) Y! W- d. Q6 H
/ U# i* V. E- p% v# q' A4 r7 s
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 m' ]; B7 n# ^" H2 F1 q 9 U$ }' _6 f0 O8 P c/ M# B( i
C:\>ping -n 50 202.103.96.68 : v+ ~8 d9 J5 E
; |- u8 m" u9 L. h3 `: O
Pinging 202.103.96.68 with 32 bytes of data: 3 Q3 f b) ]( m4 K% r" k& |/ M
4 H5 w6 J' q) p( d2 K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) P. h* g8 T q1 T; Z. L& t
4 J" q N3 d' t* I0 _4 V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 l. O/ a0 v S+ H2 X- g
4 b7 r! U6 ]: i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 C- f) ]' u0 a' ~5 E! n! |6 O # v5 x* r9 W1 }5 y* k
Request timed out.
- E- k: I2 P$ b: }9 w! b2 b- ? 5 x% z" d: ]% p. h* [, J
………………
x7 Q& ^; s/ ?6 s8 r
# ?" z e& Y" k" T% J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( f/ c- V6 p, F' W1 Y) [ ; W6 X! b9 c; J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' @& i U5 r( Z( \( `( |+ y
' [, g u- d8 l h: [; m; {
Ping statistics for 202.103.96.68:
! G D* d' |( q6 m; C 7 }8 W$ U2 }' d2 P3 h! e- V: j) H
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% l; ?9 n/ ]1 A( s& H& a4 A / g: r! [' I' z( }, h% k
Minimum = 40ms, Maximum = 51ms, Average = 46ms
, Q7 ?6 y- V( x R. v, M6 q+ z/ n . y- O, ?3 u% ~: H% g3 N
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; b1 G1 w5 g3 ^6 r
, ~" Y& s0 C+ b1 @) p0 _$ E -l size Send buffer size. # U) N8 q7 v& ?; k( q6 [
! J! G* F! M) s: Q; c3 w! a. o: T
定义echo数据包大小。 |
|