|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
( H; U {; v0 I7 J4 W7 f2 G8 N & D" s' x4 P. t( o8 ` e
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& G; ^4 o* Z9 t+ n. g
: L$ _4 S( L, U; w 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- |; e: M& V
2 W+ w1 f2 r/ z0 u
Options: 1 `1 ~9 C* `( ]/ v1 R- m
. w- Q# k8 T! a( }( u; X1 n$ x- [
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) o, O$ z8 @" ?. X# Z5 ? % P2 m! F( b% R% [9 p( j
不停的ping地方主机,直到你按下Control-C。 . Y3 ]. d( k9 M6 p1 X( f! g
! H- r0 Q5 ?# I2 S. @4 x( {: ]
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 3 q6 B# O6 ^9 Y* O8 n. y2 p
: G+ ~, v E, \0 ]
-a Resolve addresses to hostnames.
: \# B* x- {& ]7 ^! l6 D- ]
3 L) [ o' w7 s- N% ]) X* i- \ 解析计算机NetBios名。
W3 @! v& |: W: N9 b
( D) v' {8 d0 B! ~8 s 示例:C:\>ping -a 192.168.1.21
" v5 b$ h! p0 q% x4 ?" j
. g3 R D+ p0 Y' @4 y" @ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
: Q7 A5 C5 C2 |* Z. }: d
+ D2 b G. R* p0 \ j. H Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Z' |' c+ m9 S6 M & z; B, ]4 T9 k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 F0 C i; y: t. H
6 R. o( s5 F5 ?* b. [, T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 f" y; U9 t# w1 B/ |) ~
+ C+ M/ U& y5 P0 z7 {
# |( }. s% E/ ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) }8 @+ E b' y" n: }; c. `
4 P" l2 G6 a. v Ping statistics for 192.168.1.21: - r! a) c5 I2 Q) |1 u8 e( A* o. B2 N% G
) q7 M* ?, M+ U5 j, G; E Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: $ j2 l, G5 T3 q* ]/ n
/ N1 z% a( i% K Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 R4 `6 I h R j8 ]
4 @9 G' {: Y6 R, n$ j W! E" r5 \ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 K% ~4 G9 `7 P 3 k* w+ Z( m9 q. v1 D3 n7 h
-n count Number of echo requests to send. ) O. K Q) S. i! @
* b: b2 t5 Z4 `' G 发送count指定的Echo数据包数。 1 Z) |0 u# B" N [
/ c0 F- |7 t, k! ~* L
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
4 H- r" m* e! H. }& j% e ) a% g# R' ^4 U0 h% k
C:\>ping -n 50 202.103.96.68
$ ~: [! z- o8 B* x + S+ f: q2 e+ l( C8 t- Z$ J3 I8 A t
Pinging 202.103.96.68 with 32 bytes of data:
7 N1 S N6 i8 T: q7 C( D
( U C+ g4 m# ?0 \ c- ~, r7 X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 ^0 [! I9 T6 `/ X' D8 D- I ^4 B) P" K- d) v6 e j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ E; Y$ k. a& W8 U
; ]& w( t0 O8 W# Z Z1 h; M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( p" p. s6 l" s/ A2 `7 j
6 S6 F. \7 ?; V3 R( b Request timed out.
- M+ }8 O; i& M# \" i' z 6 u3 w8 A, `+ v/ D3 M, l4 e
………………
7 O9 {% }9 c* V4 N' v
& C) Q! |* Q1 F' _# P% j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 t7 {; V: @0 q0 R# ~+ g5 I1 D1 P
5 c+ H" ^$ }6 _7 x3 E7 K) J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " ~ W! X" J. k6 i9 N: I
5 ]" ]5 _( D m8 A Ping statistics for 202.103.96.68:
7 J4 ?3 _! i/ D# g2 f4 o 7 ^+ D: p! r8 f" z, O
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - Z$ b5 w h ~" V3 T( p
" p1 ?# t' y; [ Minimum = 40ms, Maximum = 51ms, Average = 46ms ' _0 z9 }( X" y; P
a3 `( U" d& v6 {
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 h" @+ F. [$ u( P( d
* {7 f a9 S1 c6 c -l size Send buffer size. ' l/ _3 A- g% {5 N: u: @! @
1 l! r9 I$ x1 L3 H9 f 定义echo数据包大小。 |
|