|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
: r% n5 w7 @7 I( t3 B# E% {4 y
" A5 g5 l: s: S& \% i6 z 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: " I/ K+ `' H5 ^. C& v7 U
1 Y3 U6 N6 s5 q6 u* x* F6 y" Z
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 % e& J2 I/ {+ V! ?; B) v6 G
; `$ q$ V9 @5 w, I
Options: " @! ~& n8 \, T# N* T/ D- B: `
) l: O% C) k9 T3 s -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. & w0 @0 S: c3 N& l3 [1 E# A
1 i' o& h$ @' D 不停的ping地方主机,直到你按下Control-C。 ' e7 F' b5 N( _5 ]7 F' I( l
9 P/ p8 m# `; _4 {
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 - F( T- U3 P4 f# B+ _
1 g$ w% y* L% w$ l; H
-a Resolve addresses to hostnames.
+ W( ~+ |1 J; A$ i/ r # R5 K% s! w2 ?$ A
解析计算机NetBios名。 5 ^0 J2 ?( |. U6 X, F
1 X! }9 V7 c9 n* } C
示例:C:\>ping -a 192.168.1.21 V* T. C6 z% x' Y4 S# }/ _( N$ s
6 [9 i. ^1 J$ A$ }( J! g4 a7 i Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% M; H% S$ U) g1 o# t& l2 \( h 2 A7 \( Q/ e: x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
M3 r" |3 ?0 S c9 h( ~: E! m6 M" r
/ y( h& X/ d+ ]& _: n Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
j( E- u8 b7 c) q% s $ j# y" q; E2 i& M* C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % a @* G5 m% C! e3 }' T; V
# f9 G: Y% I! z |* i
( h3 m% g# q6 p6 [* N# C1 K) ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! g$ b$ J; V9 }1 Z+ w7 }
, K* n; ?( W; V# B8 o Ping statistics for 192.168.1.21:
3 I5 W' o' b% H6 h1 m # I2 y3 v, V+ A7 V! \
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : V( N. ?1 J/ k M K1 S, W
( D) `# K3 d. p3 T( g1 |3 q
Minimum = 0ms, Maximum = 0ms, Average = 0ms : r3 B! ?7 k% d9 ~8 b) e
+ T r8 o5 J; A* ^* H3 G, q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 p/ R" x5 a, M$ c1 j2 ^' G+ x
# v) D' n" ?& L! C; | -n count Number of echo requests to send. ) ` T! m9 @2 L) S
z4 E) U/ F* P j Z2 D( T
发送count指定的Echo数据包数。
% y2 ~: K1 e1 ^; A8 ]* w- x$ d y
1 w' t1 w7 S" K% e" F 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 E1 u. O6 Y- X2 l$ f# s/ \+ C- i 2 L5 T/ c" h% l. H! n6 x# v
C:\>ping -n 50 202.103.96.68 1 v9 }: x2 S5 |0 z9 Q8 t
4 u" X6 \0 e5 e0 m3 q Pinging 202.103.96.68 with 32 bytes of data:
$ G1 f( ]- W: L9 P3 v a, Y
7 H- V4 V/ R9 s# \" i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - r3 Z9 p% }0 b/ Q6 \" ]: \; `
( V9 q2 r$ Y0 @2 r8 f2 f( w2 \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) M H K) c. ?( D& H$ ?, @& @ n' X
- T( _7 o" U4 Q4 u" Z* V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ Z8 {8 S! D2 Z; o3 p& I5 @
! u8 m9 C7 K3 ]- E, t" F
Request timed out. * q1 m% }4 K ^9 h
2 P& g9 Q5 j6 B/ s6 C) i
………………
( L0 [" g% L# p; ?5 W& g* }% d2 Z
; C5 G. U% v$ l- ?! |$ t5 A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 `0 X4 f% E. W# ? 6 I; R" r Q& @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" H2 j! }* E |7 [ 9 ?2 d1 P% }; Z
Ping statistics for 202.103.96.68:
* a! b8 H" D/ a+ z
( E+ G# X& H. y. b. u3 S2 m Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 v& N, O. j" p6 n) o, n) v
6 a2 P. v Y2 K; i) B Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 u( J% D# E' ?1 |6 Q$ B
4 w) }) Y. h& g5 E" `% J 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
# e7 V1 y9 R" A: y
3 V! M; |& |2 |7 x5 `# y& | -l size Send buffer size.
; _' S2 V# Q7 y" [
# T {( h; q/ m( P/ I: A! y# n 定义echo数据包大小。 |
|