|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 i) r9 @ l5 k. M5 s, `: d5 Z : @# N; w- H) U4 s
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# S" @. E& @( ^3 ~; @4 }- K + f) P/ @% ~" s/ ]
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 : ~' _+ i, N7 a3 l/ e& W
2 p1 s! X2 ?7 H" o' ~3 c Options:
5 Z9 V& u+ N2 K" t0 J ; z* J F5 R% k7 ` E9 N. V
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- M* g; V6 f' }% d# y% i3 d. f$ [
/ b2 }4 Y, [. z; D7 z3 q# | 不停的ping地方主机,直到你按下Control-C。
7 F5 _# r' J5 h& I7 l! a3 i$ b
- Z8 d1 |) P0 |8 F9 a6 D 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 N) @9 l8 P u3 N% N# q: y# E: |
5 o9 x% h/ f3 {) [( o2 T -a Resolve addresses to hostnames. / c9 I0 \# ^" n% z: W' j% K
" W9 i/ v4 z/ s* h4 r" ^
解析计算机NetBios名。
, g0 S/ K: D) w3 a0 U4 B 1 e8 A& p4 I" B
示例:C:\>ping -a 192.168.1.21
! L4 K+ M" U. t
/ u, A" ]2 Y/ f) H1 }" |/ } Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
& G# m1 z# Q* Y: u ( U+ ^; M: V1 H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / Y5 b9 W/ H6 |% _/ {, c
, M9 g3 n, g0 }) c0 }: x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) A! _& \5 ?- {4 _* w
3 {- `! O" x, t1 ^3 z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * Q4 t7 G5 z1 C
! B) \. ]2 g* ]
C; J M- k1 G `9 B Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' f9 l: q; `6 F" b$ n' h7 w* E
7 d9 X# Z ?; | Ping statistics for 192.168.1.21:
# j1 T" D7 V9 p8 f1 w: c 4 k/ A9 |. I1 d" w, r& i( R
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
: i1 E- Y# C. o' z# z + u& f7 M. n- f4 q4 B
Minimum = 0ms, Maximum = 0ms, Average = 0ms
2 l0 ~3 P, r2 { : [. e/ J- R. E3 I
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 o, s6 E/ j( A- C% S
5 H _3 i, [+ F$ v. }5 b. P; n+ P
-n count Number of echo requests to send. 4 O _5 [+ q/ Q4 Q
+ i4 D6 e8 ]7 u; p% i7 X$ P
发送count指定的Echo数据包数。 , O4 A# d Y- I/ s1 g
! g2 `- F" v$ f1 f% W, k* Y 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! g0 U$ ^+ ~( _5 ?1 P4 X
5 y; c$ q* U/ Q6 u% T0 \5 o C:\>ping -n 50 202.103.96.68
8 i# d5 W7 [- Y, A- D: d2 l
& S) [- f5 c, s5 `! `( g3 W Pinging 202.103.96.68 with 32 bytes of data: * I/ {( @1 n0 f- N/ H0 @
1 V: T% I9 G4 U k! r4 q8 d* T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # ?" S! A# |9 A- W9 P8 O' ?
7 l9 @9 A5 u: s" U+ S+ \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ z# m5 G- N0 Q9 t; n
: ^3 F9 G% Y$ p! V5 l& m3 u Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ ~- Z; k8 f( a( \4 N/ D7 X ) r$ j7 d, N @9 S5 m
Request timed out.
1 X6 d+ s: i, T: e* F 1 Y% } l- Z- D9 W; {. V" j6 i
………………
7 V! N3 r1 I; c% i . k t3 ]7 _) C \2 {, r% N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 R; i$ S1 i+ W3 p
+ r! j. q: c) N# e" e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 q# s: h5 u- l z7 R, C# G
; P4 c$ p% b* C$ m
Ping statistics for 202.103.96.68: ) v M4 K" p$ C3 k# v
' c5 a' n# B! d0 y Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 O6 O& Y, ]4 }( q3 I/ L
/ E3 `! q/ }5 B
Minimum = 40ms, Maximum = 51ms, Average = 46ms A* z7 ~% U9 b9 T) H) T, |9 v
+ @" i: q' W* e 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( Y0 k; I3 Y# q) k8 [" L+ y
0 m7 W3 C6 J. ?$ U5 D! T& C -l size Send buffer size.
# J. I, Z4 T E- Q5 w
+ {- a% j( D' ?9 ?5 O: v) @9 z6 P 定义echo数据包大小。 |
|