|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
! b1 ^' K' n1 l% _, Z4 F! ~; M
7 W7 W0 c4 m$ V/ q! G! z 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
6 o5 j5 s( E( U" |+ T H/ d7 ]- O. R6 a% Z9 b& Z. l
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 6 v! ]% `% R, q1 X7 E
, ]# A2 C; x# \/ y% L3 a- P; o( F
Options: - N2 h) u; ?8 ^/ p4 y. G0 r
0 `/ u4 B% H. F8 \) o/ j -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 \( k. f! s, u$ z
" a5 Y- j4 D8 F5 |7 P$ K 不停的ping地方主机,直到你按下Control-C。
) j h8 L! |3 [5 I) |
2 \/ }, x& { c5 B 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ' K6 Y, ~ x) W) s
4 O5 u! P8 X7 y2 q2 O/ {
-a Resolve addresses to hostnames.
" D* G a0 z; }8 _$ @
G& w, v N( w: Q2 y% k 解析计算机NetBios名。
2 o' H- p6 p3 z2 k" X( o, Z
# s$ m( g+ \, M* n/ U 示例:C:\>ping -a 192.168.1.21
6 J+ J: ^* M: t. M5 b% x# H/ N
6 O) y( [3 E( c# Q) W$ Q$ g Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
7 u: ^7 g6 j4 }1 J, ?& h
8 X7 T! p' z. W4 D0 Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; n( S9 M% K" s) o
" Y2 a! o0 }, p' @- T# a. { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' f& B1 [* a* J! L/ d
) g0 w5 w5 L1 h9 R/ U) O- |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 R/ e, Z; W9 k
4 R) a$ }# v! T1 p$ J! `
6 g$ v# h* l4 R/ j' s6 x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- u T f0 L* q+ R
1 @/ Q @# H! T: {. B" z+ I4 B Ping statistics for 192.168.1.21: 3 B/ a/ r3 p/ a! y1 K$ j+ o! R
% p' l4 ~* c. d6 p Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
6 Z, [9 @' L/ }% i! a
. ^& o! R1 o! t7 z/ b Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 T: Z# h4 J/ l3 u2 d7 w6 _
) w- u' h3 p. x' G" x5 C 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + m2 O5 _) y, |7 V. K
4 ?9 q8 Y+ j0 Z
-n count Number of echo requests to send.
3 A4 k8 V! c0 w2 ^& }" B$ M . s+ L& v4 W3 S! T. r7 _1 e+ }6 L4 d
发送count指定的Echo数据包数。 3 \+ t1 D' f) |# v; l8 a, ]
" A. F: w8 C3 R3 t8 z9 ?
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: # A2 ~4 g2 w: q9 U
3 k. d! Z! @1 l8 j; }! L C:\>ping -n 50 202.103.96.68 5 ^( u' m' R: v! ^9 x! C
" a' g* n. d* M Pinging 202.103.96.68 with 32 bytes of data:
6 P. d8 G1 B# L7 z8 `2 l & S3 m. z8 u, C. j5 ^$ C6 x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 B& {* z. U9 v3 A% u2 f2 @+ B: A 0 \6 m2 C1 I7 b) v+ ?' x: w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" ^5 }8 L7 F! x
- @. ?( W; r8 w ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 c, B- @$ J, b9 R, w+ w
+ ^5 I* ~. l& X+ @2 Z' h, }' B Request timed out. & J1 f+ i6 B2 H ?1 q9 f1 N
! L) v9 ~$ L9 W8 i! ], e, F ………………
}8 {# P( S4 @9 w w5 T; e2 q
. D8 i9 W9 W; ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & j- b: ^6 P% q" |+ Y# a
+ _, b& j$ L7 e6 u) X; P; h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 d; j1 n. t" T* m3 S- @
3 C$ @" h& D1 H Ping statistics for 202.103.96.68:
8 M( G0 ]' N( E/ v; j ( }/ D, G- f& `
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & h' Z1 w, |6 \, B" u4 x5 r
8 n3 M$ t* L6 `. Z0 S4 P
Minimum = 40ms, Maximum = 51ms, Average = 46ms 8 Y& R* F, b# W+ u0 g) N1 [
S! K2 s4 e) @0 O Z4 I 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 1 x1 h% v* w) ]) f! ?
2 C/ M( E5 v0 B0 b/ f/ h -l size Send buffer size. 8 e5 x9 a5 i! K }5 w
0 k/ a- t: d& I: T 定义echo数据包大小。 |
|