|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
`! c1 \# Y. c
: s3 N; Y) B8 U4 w 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 5 Z. S9 m6 z* E2 e# l+ R) y
6 } W0 G& o9 Q; e; A 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' Y) j n# y ^3 J3 x % ]5 z' u9 E) ?5 z
Options:
$ S: N+ B1 M+ q; n
7 X' m. Z; D% Q2 @ X7 [ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# B+ F$ }; v( @& A
4 ~0 K: r) C( [* F 不停的ping地方主机,直到你按下Control-C。
* C$ D- t2 W$ z9 y# K
, Y# a6 \! k9 x" U0 ] 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
2 P1 P; T% G- J& ^3 y. j
6 p7 D, }( \. e* \9 f2 a* ?4 Y4 I -a Resolve addresses to hostnames. - x2 ]9 {3 K4 r. ~7 l" M0 x
! `. H# @7 y/ H- m4 H 解析计算机NetBios名。 8 x& Q- O! W( l( Y/ ?
# s6 Q1 a& [- a2 G- q
示例:C:\>ping -a 192.168.1.21
! a& ^3 E3 D- U3 x- f3 ^# b 6 B% w; B7 x' n& d
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 a: G8 {% _9 z, U5 s! I / |! Z! \, B/ _: s2 g: A- }! Q' A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 B3 C$ k+ R# v6 e7 a
3 N* F! L% M( p; Y& X& X+ g9 M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ T8 O1 n1 @; j5 V6 V$ B: h
! ~: H1 }* x+ `' d& u ]: C Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " @6 c7 P8 L6 Z4 i1 b
( y, O0 C0 ~1 Q- J! q
7 A9 e4 X# y1 s3 `) s- s: p6 ^, Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 e8 g2 ]% ]* S" h% A' r% H; L
! y3 w( G/ m/ E0 N' E Ping statistics for 192.168.1.21: 3 s+ z$ C* I& U9 t u3 E; O }7 r& o
. t! S1 a' |2 y t9 p Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; I! Y4 F! w' l% }3 R& ` ) g# y2 ~$ R% p+ n' M2 i) ]
Minimum = 0ms, Maximum = 0ms, Average = 0ms
* C4 ?6 A! P/ \/ t% { K1 d
& |; A, z+ a' q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
7 m) e: A; f. g! {# z* b. g3 S1 j 1 G+ y8 A# Z8 n$ |
-n count Number of echo requests to send.
4 V% F% ~! `# u% I! Y( V& g% p 8 I* B; e) X) W" N
发送count指定的Echo数据包数。
3 ]" c7 A* I6 f- H
& f( W# S3 g) \ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: & n+ \( b0 ~5 {! N
+ q5 V5 L) [+ b* D0 b C:\>ping -n 50 202.103.96.68 ; r+ ~3 ~. s" m
+ G# G1 g* L( i2 }8 Q1 Y
Pinging 202.103.96.68 with 32 bytes of data: : o) |- @% H5 n) o9 g
6 b: z% ?3 Q, H- p# R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 L4 U+ x9 Q( l ( c. p. S! G y: `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 W/ ^: p" }9 [ 3 D0 z, E D0 u3 a4 v; Y% q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 O3 D' x, F+ I5 {9 p2 H3 Q
3 k) L t9 Q6 F3 g6 T Request timed out. - Z# v7 M6 V9 @* |
2 l% u7 X* Y! ~
……………… ) N7 c5 r. r- N" I; y
& W7 t; @& o) N" W- R, x; C+ b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 R0 I& |2 z' S9 R0 D6 ~
% m/ Y" _& i$ @- k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 z8 N2 `! ]: [ n# M " a- ^# |3 ^; X+ D& R
Ping statistics for 202.103.96.68: + }2 J! ~6 M- L% k: Q8 Z
+ D6 o u! F# [! }9 h) f1 i
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 F2 c' ]2 n- k' t" B$ p4 |
0 C9 \6 x: [) @+ m% m$ t Minimum = 40ms, Maximum = 51ms, Average = 46ms
4 f0 G0 p; r! }& }" g- ?, b 7 e' w' \* W+ }7 F* p
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 O$ e0 W+ b7 w; W" q) m+ b
7 J" i1 x- A! |4 h
-l size Send buffer size.
) Y- }5 G6 p. d2 w) p6 q% D/ k + Q$ h! u5 m! M# n4 ]3 e* K
定义echo数据包大小。 |
|