|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 . r6 {1 w1 S1 `7 I2 q+ X
% {8 R, B+ @6 x) r" S; X' R% p 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
+ n3 V$ l( h; C7 X: ^4 T4 l
* }: o. S, ?5 | 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 / i7 W8 n6 V' W0 L
% R0 r$ `! F2 h1 c# s( N Options:
+ }' ?0 J* O+ `, i! ~7 t, H 6 j q& W2 M0 q
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% V+ n2 P6 F: A( m
: s1 }: V* Y/ {1 f. T 不停的ping地方主机,直到你按下Control-C。 5 f/ Y" m1 B7 m9 j0 S S7 D
5 n8 u' a+ y" F6 \
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 2 p( l* F4 ]3 a* a
$ ^6 s8 C! v6 q# n6 H0 q$ Y/ S -a Resolve addresses to hostnames.
) v1 [3 ^9 a8 U% A1 ^ . A* V/ h& x \& `( a3 Y. ^& _/ d9 w
解析计算机NetBios名。
: S4 g7 C: {# `( m# [/ l I2 {2 M 2 l2 z4 i. L# c6 | o
示例:C:\>ping -a 192.168.1.21 & |4 D& {* _9 Z9 R& y. L% t
. u5 c% |' Y% u% N, e* F
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: & \: @/ C2 e7 p& M( Q
( @$ k0 `5 G$ M; R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 r" w- E# |* A/ }8 E0 _
1 V. Y% ~4 ?, h: v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' B) o- A2 U- ^- k; t / S% o8 G- |( J) t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 b o# M4 A1 m' ] F& L
; w2 m) S* A& s- p H$ A. R
" `; _2 W) m* q4 ~) |# ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + `6 Q4 c6 w: O! w$ a4 @
6 P( O6 ~7 c: G4 q# }
Ping statistics for 192.168.1.21: : \+ ^. u9 E5 X; b- f" {
3 m9 h# z4 s. v6 A1 x" a, Q, q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
3 @2 C1 `, @2 T0 p7 y
7 ^+ T0 N+ H: `& V Minimum = 0ms, Maximum = 0ms, Average = 0ms
! Z9 G- [. T) K8 n+ v
! x* @# w; _3 T. ^1 w a 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
) l$ {3 [: Y; g+ O2 {
$ g+ h7 d; Y1 m3 ?3 a$ {- S -n count Number of echo requests to send. 9 s/ P: }' R6 a$ ^
+ x7 T# R# a) F1 `% G3 M! k3 ?0 ]
发送count指定的Echo数据包数。
- g1 c' s6 d0 _% P5 D , \) Y' S0 A2 N
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: " Y6 j( e) h6 e3 S+ L: a
" m0 r D- e0 Q$ M; B; x+ v8 V
C:\>ping -n 50 202.103.96.68
* ~ x; A+ P7 o4 L- k! P! [, j( V
% v: ?* G4 G6 {# Z! y7 W# U Pinging 202.103.96.68 with 32 bytes of data: 2 A/ N2 g5 d% D4 y
& x9 I* b& V4 Z7 ~$ _9 Z1 O* ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
v+ h2 F0 c* ~2 S6 o' V* ]2 @ 6 [; g( h. G1 B# r% C$ n5 [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) i1 S3 |$ b. w7 i6 n( s0 g ( K. o3 e4 y$ ^* C: l9 b" _3 G
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 P/ t. O: r- p9 k2 q
, k+ L* H" g- ~0 C% w3 a. L; q8 e
Request timed out.
0 Y3 I' m7 ~! u8 e
2 g/ R$ s6 n B' y" c% g) O; K1 s ……………… 2 W9 b: b, u( l
# J4 d( B! A4 @! I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 p; s# T1 ]8 @9 ^1 [" u) K
1 S/ r2 A+ s- G3 ]6 H* a& z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & U; G( l. R& o' ^' i }: v+ ^8 Y
! _* @9 E ?' w/ n# J6 u Ping statistics for 202.103.96.68: ) M* `, b# w* ^( u
0 }) p* S6 M" a
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" q7 Z7 E7 l H. ~ ) _7 `5 u' L3 U) T
Minimum = 40ms, Maximum = 51ms, Average = 46ms
& i3 s+ I. |# C9 S" o, y ! ?6 U) j6 Z4 v) }% }
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
7 `1 R# P9 |3 r7 X
9 Q5 _2 } G/ l0 Y& H/ U -l size Send buffer size. 4 @, A3 Y& F4 W+ o; p7 s
2 u' F: B& g$ L9 K0 |. p% a5 i
定义echo数据包大小。 |
|