|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
% l$ k7 ^9 S# E/ f0 m
1 ~% @) h0 N8 |! F5 L4 I" p 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ; C5 ~1 E) E3 {. b
" r( e% n* d3 x$ B
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 $ M& e; c7 F4 ^9 Q
' H* z5 z6 U, p; q
Options: . f% c' R+ r+ ?2 p' |
f& m4 j& h' ~& A% A) q -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 L- Z8 i% G% p, ?5 f7 H) p7 p: r3 n. i
3 c5 ~; ]; m* `& l 不停的ping地方主机,直到你按下Control-C。 ) A' c- A6 [3 G2 q2 P* \
) u' I! q& R7 C+ ]
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
I3 E4 s6 k0 [+ ^" _/ M 5 d4 U; Q( h0 e
-a Resolve addresses to hostnames. * Q! H" n; S4 V
. ^2 `6 t1 j I8 x 解析计算机NetBios名。
- [# p, {) X/ K4 D' P7 ]& e + E" |0 _; V& |( P! {0 S
示例:C:\>ping -a 192.168.1.21
" r, M4 ^! \ _9 k( E3 Z# f - E, Z# f$ i& {( B; Q) F) r
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: / b* j% g- V2 R$ [% b5 c! C1 h
; X! }9 B0 D1 v' D# h; n Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " w% p V$ T' n. F
8 c2 n1 V) T; C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 W U2 K* X/ b3 v; m; _2 u+ E) ^ * Q9 n& z/ T: D" h+ Y% R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& ~. ^, q3 b! f3 P6 N( I; [2 H- f0 U( k. f* I/ g5 K# x+ k; f
# p6 u4 W. m0 i% N1 G+ m% }0 o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) |! X' P9 C! W$ C & c( R& T3 Q. q4 V, b% v+ m
Ping statistics for 192.168.1.21:
( ]4 g# E n' A2 A3 D; C: E 9 }+ w/ w/ G9 u1 w
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 ^- |' L) ^* X2 ^
9 I- Z! h; Z: Q Minimum = 0ms, Maximum = 0ms, Average = 0ms + q2 q+ C, Q4 U* K% N" o, W, `7 g
7 M1 I, A- t9 q4 w! N1 T$ ^6 O4 t$ S
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 % u1 U A5 z" Q% P' S7 A$ B0 V* N
' T7 \9 ?! B' j4 b9 s
-n count Number of echo requests to send. " s5 b' f9 \: ~# r9 C% G: g8 b
$ E) }7 z7 J9 h9 A+ b; J. ~ 发送count指定的Echo数据包数。
5 }$ t# p% J8 r* \. g: D. P
- j4 ~; m' C& U6 e" ` v0 x! O& b 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 U* |5 s7 `) `+ O " E$ o' a! p2 x) M! Z! r, ~ X
C:\>ping -n 50 202.103.96.68 + n: t# y9 D( n
4 D, U/ I' K0 P; Q% u) B
Pinging 202.103.96.68 with 32 bytes of data:
- |9 n! v1 f: N" J! W
: H; D% e# I1 ^ z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " t( \9 A% F3 q1 y( |) q8 J
7 F0 a' i0 ~' }* }: }2 Z. ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 W) w0 h! E# T! E5 q9 h8 c 7 K2 A$ B2 G. a# K2 C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 U) O( c1 V. w0 ^* T1 \
# a& ^* I/ ]# m U( | Request timed out.
3 c$ v9 s9 _' d0 C1 r
. L6 v" n; D/ O. L/ c" |- e ………………
% u0 l. ~1 v; t9 z7 p- d
' M1 [9 I0 ^% C# W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 p+ s7 S: Q# m J, V, ] ( w% i+ B8 k) o; Z5 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* u0 w4 v4 t. y; E' R
' I- q0 Y( G* y5 a Ping statistics for 202.103.96.68:
( n4 D k) k# ?+ z# i . |5 O% [8 I& n F# I X
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
]& E# F, [7 V; m# Q: K2 R1 \5 {) w . F2 {& k' g2 h F; x
Minimum = 40ms, Maximum = 51ms, Average = 46ms $ [4 F* }, l) x: i% ^
8 W9 O- A2 V4 X! Y* s! F& \ k 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 `. A1 g/ f* [" U* ?# e
& a+ I9 ^3 @$ [7 F% X# i* m
-l size Send buffer size.
% i- Q S* H* `' R3 V! `* o; j ) {) ^- C, W" x p# p0 I! x+ r5 ?
定义echo数据包大小。 |
|