|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
: C& U5 Y* W u) E
( h: h3 h3 V6 D$ B: V4 ^ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 q3 M/ n0 ]+ Y9 a# D4 D) Q
2 F _1 z2 |: I( ], r+ P, 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 ; f& r2 }) d h/ M( H
$ f5 Y& J; H6 |( @' i& b2 \ f
Options:
4 w) t# }: {3 I# b
8 j# K9 i# b9 p% @8 Y4 {- z -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 9 Y' I5 D. o3 e( ]+ F
: i$ k! A' d4 ~* [% \( O3 @1 h2 k
不停的ping地方主机,直到你按下Control-C。
9 E& j; j/ \' w$ Q+ n- R- R
G% ]1 z* g- q4 P 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
! |4 P T7 w2 `1 L
; D/ [8 E4 W+ ^/ Q, e) |8 ] -a Resolve addresses to hostnames.
& b8 T3 O+ T& A$ S1 o 3 X* l* F! O% Z2 L
解析计算机NetBios名。 ; b1 o* z Y# Z6 ?9 M( a8 ~- `
7 W% I2 Z1 o$ ~4 P# @3 h% c 示例:C:\>ping -a 192.168.1.21
1 X4 F. e$ \5 x) r# s9 e+ l
' g0 M4 |0 l, m3 O, ]2 Q Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 0 f, [" n/ Y+ }7 Q; N3 r9 H; s4 |
2 O# F, g' Y; x' a. O' x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 G0 K3 k' s) y4 c' l5 `1 R W( a. @) c4 K' y/ r h: {4 g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 v8 Z, [' i* o- Y l8 ]
U y4 s- R: s+ S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; Z- c$ M1 f4 Z1 d/ J
) J3 j# ~! \* g: d7 C0 d& Z$ P* ?2 e - I7 p4 H. J' c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- `8 U2 L8 |' I+ M$ A 4 l z1 p e/ m9 t% c/ z
Ping statistics for 192.168.1.21:
6 D/ L3 Q* B: y# w4 e( c/ x ! k, ^: b7 k& m6 v) K- [- b u
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# u' }& r" t, O6 H( x0 w# q: ~0 L
( f% \) U; F* [ Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 e: B* P" C2 f
: G5 p w) Y* y# d% M: S 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. ^" M8 p4 d# V! o+ L. X' z3 y: \& W
- ^+ W7 [; v; h) x* b, \* c' U -n count Number of echo requests to send. ! E. l% R& h1 X3 _& h
! X: ^+ g# P: ~5 g' z% f# ?
发送count指定的Echo数据包数。 5 s$ {- }& h7 \4 D7 P& b
5 m6 B* Z2 }$ q1 a( ^
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 w# V1 Y; J C! @7 _+ n: n: V5 ] v+ N8 y $ V+ x, L0 `- i% p% r- E
C:\>ping -n 50 202.103.96.68
* e4 e2 S: P E $ o" G3 @& l& k+ \& I$ ~
Pinging 202.103.96.68 with 32 bytes of data:
/ {1 ^5 G* [ m9 g3 n1 P
s5 l4 x# p" Q! j* v1 T5 @1 S, a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( U% b7 u8 g8 \$ L$ |, F% z
: Q7 J! u* n; b& G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: _ i' ~7 }- R4 I- Z P3 j $ V, v2 N+ v/ @/ P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : S( }/ }# W7 X, \) K8 d: i
5 ?8 g7 d t0 Q( f. Q Request timed out.
6 H. u8 g$ O0 _8 b + \3 r7 @" D/ i3 k+ R9 E: I. a U
……………… . X: g( r/ J+ m. f1 R
8 T7 ~8 S* Z1 X) K5 j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ T: A, x; B5 U6 H8 W
4 F6 m1 V9 M6 [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; h8 K( r7 Y& L: M( b
; n1 p9 M) C7 {1 u+ j Ping statistics for 202.103.96.68: 4 q5 h1 q2 B2 |' ~7 l
5 z& j2 u: X0 K7 K* l; b Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' N0 b# _4 n: @6 Z
' L) ?7 A' i8 m9 [6 V Minimum = 40ms, Maximum = 51ms, Average = 46ms # W. {: A1 _2 y/ z' v2 [2 o8 L
% @/ w: B0 `. Q: F* P5 l) f
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + _- A0 Y1 l6 G, g- T" x0 P1 A
! A' Z3 x4 M, w# {
-l size Send buffer size.
3 x' Q) ]! Y7 r& y
5 v1 X4 v4 [9 [$ w* P8 h1 a 定义echo数据包大小。 |
|