|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 Q* h( k( V/ U" u
5 y( o4 ?& @, W
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 z) S- d q2 v1 L6 T* D1 ~
! d6 _4 y+ K, x1 v: S+ R 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 * L' [; ?# |# `5 I2 ?# o! q
* Z8 k0 L& h3 ^* l0 j2 w Options:
% W4 v7 S% q8 f) H 3 }, q! A5 G/ d! t; Y% G0 v
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / `' Q# r* N8 ]. I
# k; Y- g4 q' Y' T6 N 不停的ping地方主机,直到你按下Control-C。 $ Y4 c. X9 L* L1 W: V
0 B: G8 I4 x8 c3 s" r2 j0 k 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 J$ F! T' P2 M1 |" ^
3 U& ` U% P% r# U7 X# @ -a Resolve addresses to hostnames.
) i' Q: J$ D, Z( |+ f/ @; h
4 n7 B6 K) T2 O' s: q2 W6 W x 解析计算机NetBios名。
( F0 R: r0 j3 u9 I9 @: J+ P) a" S! G
# K' O9 X* f2 {3 m 示例:C:\>ping -a 192.168.1.21
: X( G! E0 H$ y; E 1 i( L% q& ~/ f
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 v# m- g. o4 C$ V9 j
+ A, g% R+ L* j9 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' U$ p3 _- A! [% |/ S
# k, g+ b4 V! c% L" o( k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 l+ _ `1 E+ I' Q( U; d" Z
% I' J, c" n5 C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% @" p. W p- ?4 Z
! {6 g) l$ O0 V# m, ]% \
( D1 ]' P. e4 ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ i% N- P" b, `6 z4 v6 g3 } ( _$ A$ r$ Y) e# b4 r3 h. O
Ping statistics for 192.168.1.21:
4 p8 \- y' A9 u! W+ P n x7 M$ G0 ?& }( G
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 D& b4 K. W: x4 g! z; B/ i
8 J9 M2 B, A, v) c7 B
Minimum = 0ms, Maximum = 0ms, Average = 0ms 4 ]' S+ C/ c8 `- r- d$ i5 g8 n
& p. e. s7 P0 G& L5 | J 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* W: W- r0 F7 I+ V y* X $ m, o' f: C. x: H2 p- v
-n count Number of echo requests to send. ( l$ f7 r* W9 z
O# q) K% @2 o9 f( i
发送count指定的Echo数据包数。
& m4 w9 }( t5 _ * r( w! Z/ }6 D7 ?
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
$ K* s+ Q: K5 Y* l3 k4 ` 9 T6 V* S$ f# ^: f [- {
C:\>ping -n 50 202.103.96.68 ! p2 h9 R( g8 U# e2 A' @
% `# O9 g8 f2 _9 O7 O9 c+ [& K" a
Pinging 202.103.96.68 with 32 bytes of data: ! h' ^/ r# ]( ~& a5 u7 o
8 W0 c$ F- S4 o Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 d+ |7 L+ y5 o( p2 `
8 I! d' L+ z% ~8 [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. r' s+ R* N6 X" M 3 W V: D* B a; e. w5 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! j+ k$ Z/ I( [$ _
0 ]; H; X$ L6 K$ y Request timed out. $ B0 q3 V1 s z
/ [0 _7 k" D$ N$ C ……………… $ k; N6 d: h$ g, j" |1 G
9 S# L/ U5 @& \, j; m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; ~: ?$ I- [6 q" l- N* X" G
9 w: Z9 U6 ]) m3 o0 w( o4 r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ h3 o3 g' O1 o- g& \
% |" b ^1 t; {; `, Z) b8 |: ^ Ping statistics for 202.103.96.68:
: Q" K6 v+ _/ l! |# N) R
' l5 k R% m- P5 ?& [* {/ [2 N1 w Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
/ b' d3 E' u- U+ G" b' _
# Y& p! E3 J6 m2 n& \ Minimum = 40ms, Maximum = 51ms, Average = 46ms @% |5 e6 Q0 K% b; |. ^$ e
2 ~1 }% E, F% f; i 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
+ s" W9 k5 \9 _ 0 d2 t% h% P) x7 @2 {
-l size Send buffer size. - K# }1 R9 P* N& b( j( T
* G8 j% _3 e5 W 定义echo数据包大小。 |
|