  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
- \+ L. E; `$ l$ X. h ( B. e4 U5 ^" F5 p7 F' Z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
- p3 u7 d, _2 |
* J* ]5 U# r" m0 N1 P$ e g 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 * l5 I/ e1 J" q3 w
0 K1 r4 x, ?- g8 [
Options: : P |$ b! j6 E I2 M! q. b
e# E$ G) v d% j P9 L) Z -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 6 a- o7 Q& `5 N& c" F
6 u5 S" E3 S. T" G" y2 e8 h 不停的ping地方主机,直到你按下Control-C。
% C9 S0 U: F: \ - K" P2 l7 E9 V8 w' \# Y8 W
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( I; G2 r. n6 z5 @- }. n$ J0 G
; j$ Z; k9 @+ }8 V% P" J! {$ s
-a Resolve addresses to hostnames. ; ` h1 h' D I0 K9 O. x# G( r: v/ b
5 \, m3 F% e A) N 解析计算机NetBios名。 ) r8 p' f, m' M
+ V. O- A* P9 j0 Q# b5 V
示例:C:\>ping -a 192.168.1.21
* T6 D! l8 y8 C0 H6 Z3 g
! p+ x- C, S" k i; j Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: X& N6 i3 L% l7 G3 \& @% i
9 F4 `- j5 r2 `6 x3 h) y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ }- I m6 n! I; Q/ T
0 ?/ }+ A" R) E0 `2 g- v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 z7 v7 O* t$ z% |' T3 S5 q' b8 L
8 a' R9 P5 S* h6 g. ^! a7 k" i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 e1 e; i* E2 h; \5 e- J
3 {! K4 j/ v; M* a3 n* ^" W: |; O/ x
2 n: E0 h! C; c Z0 c" G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # H0 i) S* l z; x1 A B
, K5 I& L1 I8 I# q/ I3 D9 Q Ping statistics for 192.168.1.21:
& Q. a. J5 \4 V9 j. p 8 |* i" B0 y. @& g6 `& M8 w
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
* q# Z- W8 _" _- V$ H- ]3 \( `1 T4 W7 H
% Y& _% H! L6 G* l# k0 y$ i" h Minimum = 0ms, Maximum = 0ms, Average = 0ms
" e' S: w" ^# G# X( {( }& K$ W
; \) R" V- g1 }2 c) S 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 Z$ V% Z7 ^" p$ H/ k 9 X: F" V z' c" u1 c3 L; G
-n count Number of echo requests to send. 5 J% E6 E7 k( Y
. s- a1 a/ {0 k- Z8 f/ l 发送count指定的Echo数据包数。
5 ?- O( p* C4 X% L& Q4 O
3 h# U. b3 E! u* T! C5 R6 D 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' W7 E1 M1 v1 Z7 P: y
1 X& K. J; t* T3 w) v
C:\>ping -n 50 202.103.96.68
+ S3 q; k+ _, _ ! g' P" E5 \9 {9 u8 `% }, _6 n
Pinging 202.103.96.68 with 32 bytes of data: $ i) L, W1 U' m% w
$ N5 S6 ~! T8 u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( n) |1 v( H; @6 _+ N
$ H0 A: E% H: d. T& S Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , ^/ d# x+ j* q8 I7 u# I# i
6 m4 |, w" r* p+ K* G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ k' D+ b8 q+ @: @ m) N 1 u9 o4 Y/ R& N
Request timed out.
3 T% i, a/ Z2 s' V% m# X* r
0 }/ ?$ m+ N! d! U' m ……………… 4 E$ y- f3 ~1 z `* R; B
0 }3 R( f, ?- _0 p1 k. N Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # m# n# J3 Z I% I: Q; T
+ p0 l B6 Y; X3 l+ e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 r4 C- T/ L& o
0 [, t5 C6 } b: d
Ping statistics for 202.103.96.68:
( M' I0 @7 y" z; W0 s7 w5 S2 y
5 }9 r: z' O. m; s Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
q+ S( S# ?4 t/ ^* ? 7 C' W1 _% w% X3 D
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 h5 X; z% V* B) s6 p* T) I
! u8 p- m# d- M* m8 m 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 5 A; O* D3 a2 G, X# A
/ V8 \# O$ A4 A$ `# H9 } -l size Send buffer size.
- p+ ^$ ~$ {% ~" D+ Q
4 `$ p' U% I- c( w5 l3 k+ S1 P 定义echo数据包大小。 |
|