|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ ~/ B+ t5 r2 [( [ / \. h! Q1 ]! k( e
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
! ^2 v. E& B0 b, m 7 Q1 [3 s3 `+ i
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 # O) s8 T7 l* j+ ?. z
E, T. m" G2 x: z5 b Options: ! Y- m5 n! P: d" `- {
* y8 p* _) d! q8 V4 k0 {7 T -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 y0 f. {2 S8 c2 A0 f
& @+ {) f$ E0 G2 M3 N7 k 不停的ping地方主机,直到你按下Control-C。 0 _: y# G8 u4 U% |" V& k8 ~5 L$ o
" \% o) u4 c4 n. s 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 # E2 k9 p0 e7 ]& h' r
1 `* f& d" ^, T7 `7 l( @3 `
-a Resolve addresses to hostnames. + ` `# D+ B: P, Q4 K
) j2 o+ N. i+ X4 X1 Q 解析计算机NetBios名。 " d3 n9 l& r: P, D7 u1 w* H" E
8 i) q' d, r* S" W- }
示例:C:\>ping -a 192.168.1.21 # G8 n4 T/ r& N1 X$ q
& V. ]: t. z% N' q+ S Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
) [4 e# r$ g u& h6 O ( p6 Z) U$ \( f; x4 t# N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; N4 J$ h {2 ] : f( ] b, S: R* e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 D. Q. [7 b) v% o r% b
' L. G& G' T# F- f5 d4 ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 ]) O2 ]+ [ [3 ]& a& z
; N5 ]& v4 G: q6 e$ u( S
# N' G# h) Z/ o8 K1 O+ R7 O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- f9 U+ ? m0 t1 @) ?
& l. H! C5 n; b Ping statistics for 192.168.1.21:
4 c: u: T/ a. c* ?1 I$ @# M% E3 R& Y
* s- g7 ]( w( q Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 0 p) z5 A" C; u1 W# U5 l
2 M6 C. V c& n+ C3 O Minimum = 0ms, Maximum = 0ms, Average = 0ms
' g. c) q: y) j$ a/ j+ M
" J( _$ C7 w* Y6 {% i3 Y 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
6 w- g3 L# n7 _: f1 |
( S5 r, ~) {$ s8 N1 x -n count Number of echo requests to send.
; h" ?+ B' B, H9 a; ^5 `) L/ y& m 4 F8 a i4 b& \/ l9 c
发送count指定的Echo数据包数。
" t7 M& y- P0 D " k C* V3 A! O2 [- o& f
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* k% t+ t) F" G " m+ Q' o2 J7 }0 I/ t9 w
C:\>ping -n 50 202.103.96.68 6 q: R$ x/ Y5 b+ I. k3 Q; \7 W
" Y/ ~, x& a- K( W7 Z2 c
Pinging 202.103.96.68 with 32 bytes of data: . Z( r+ L7 p" I }9 B
& P' c1 ]. B: @9 e0 L) h/ K$ z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & s. O$ y6 B4 t
! k$ I) \5 Q, Y5 E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 |# x, j- L# | |
: S$ {- T5 ^8 _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( }) N- X) {3 Q2 |7 t% m
1 ]2 y4 [1 S1 j6 v/ q Request timed out. : N/ S% v- C7 Q/ N" ~: ?2 {7 N6 \5 g
' _# }6 c$ ~$ B* C, A ……………… 5 y3 A/ `6 H h4 L' e3 T
& D* ~0 V; X9 g+ |* q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 j0 q' V0 o6 k% \! M4 b
' ]& `4 V& ^5 C% p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 t6 a, d. l" ^8 J: L ' V D; v! X3 K( J3 u. K! u
Ping statistics for 202.103.96.68:
! I7 O# d3 T9 E+ K
+ K" N: A, v1 ~' k, a Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
: n# T3 F3 C+ A7 i0 {' m( J
: o2 [$ k! m3 V3 U6 ]- N4 w( z Minimum = 40ms, Maximum = 51ms, Average = 46ms
$ w! d' l. \5 f $ o4 Q; i: T; o$ o% e! o4 ?* U
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
! }3 k. e* \ D9 K( `5 B, \
9 U4 N5 k1 O+ n$ d0 `% ` -l size Send buffer size. % V' n1 D! c* W3 s8 ^& K2 i
3 q3 B4 b8 K K; e K
定义echo数据包大小。 |
|