|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + L5 i6 @7 p2 c6 Y" T$ w
( t& f5 ?2 K1 u; |" \8 m 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, }4 u. u# _' R+ s1 Q3 X
7 ^: J" [, x9 e/ T# j* d 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 $ Q+ j0 B5 t6 ?" s
) z0 f) @2 C+ K- \( \7 ~$ g
Options: 3 c$ z/ L8 Z6 k* R: d
" H2 r" ~0 E% ? -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. Y, f2 z: I3 n8 j8 f 6 B" Q, k; d/ h/ O: Q& T) a7 k
不停的ping地方主机,直到你按下Control-C。
) q" F, v) r; L! O1 |
" S8 s3 K; n% k 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 % L) U, E' I. y4 {
( Q9 e4 C8 o4 n' B& p6 e: D -a Resolve addresses to hostnames. 2 ~0 Y) b4 E9 q1 }
* ~: Y, c3 X* W6 Z0 H 解析计算机NetBios名。
+ H: c# O4 I0 y( A1 ?
2 l, _; Z0 [. I8 ]& u4 I3 C2 d 示例:C:\>ping -a 192.168.1.21 3 e5 O/ g1 Y( j. \3 o0 K) l( J
. q7 O3 ?& J2 z W; d! Z8 B( M
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. s, c w4 T6 o) X5 R
" [, s- R3 x; I3 l0 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 `! P' z3 h( R1 d1 [% i
8 G; Q& H9 P' Z1 E& [ l$ e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 j, T$ H/ p& [# l0 W9 X
1 Y1 J) T( r8 X) L( U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' @8 n# H) M& Q- c$ i8 k: f
# P1 ?+ Q/ z* `1 K' a
! Q+ s0 a* W$ U0 w0 b. [! V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
X, x% D3 D: s7 t - D3 O- [2 t0 K* h0 a
Ping statistics for 192.168.1.21: % M' {3 E* _( x% l4 B6 Q
. e& O' `* [7 @ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# o3 |+ S/ u! o" q6 O( j
% l% k: S) E/ h5 F Minimum = 0ms, Maximum = 0ms, Average = 0ms
4 ~/ v. R2 L8 d+ |# v5 j: p A( s
4 P- t. y1 o, l5 J, x$ b, W3 f) U6 r 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ( _! I& t% [0 v% h( t
4 | I& S. V9 r& [
-n count Number of echo requests to send. ) k$ f% a7 D- |- h I
8 `+ D3 y: S# z& L
发送count指定的Echo数据包数。
) @) I, ?+ M& y: N, r- q
, ~9 u( v/ R% M5 `* ~' G* X& |9 k 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
; g% _. [# ]. b+ A3 H
( l: w( X* M& D* { C:\>ping -n 50 202.103.96.68
! B+ c9 f% P3 s/ t3 z z9 I
0 e9 _+ r8 A: w9 q Pinging 202.103.96.68 with 32 bytes of data:
# ~4 X L1 z5 R- B + N3 G7 C, h P( q' v" h2 d# ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 G1 W- X9 `! x9 E- l% S- S
) e, [( D# f3 s; R1 A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / a8 l( X6 @3 X/ a; n; Y
) P" `+ Q$ O6 p* `9 z4 f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) a' K) w/ @5 r1 s. ? / O6 U! M* s, l% @
Request timed out.
~$ n1 x2 u% B: N; p# l 3 M! g' S0 b/ u+ y! l: _# Y
……………… : E% x2 _# n& B; L% w3 `
: l( }) f4 r' O6 q2 q, u Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 K3 r f5 V# i
* X' T; \9 P' T- i0 P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 Z$ O! V1 M& }6 E
8 M' Z% k0 P4 Z* f# Z w! L, m
Ping statistics for 202.103.96.68: , |4 e. x2 ^9 r2 [8 u3 j
\9 e5 Q `8 w, {' f Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 9 i8 p+ Z$ v# R1 |6 I
3 G: f0 e2 u6 A Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ }4 U7 t1 N; Z
$ f+ F# J4 C3 V3 {: Y; C3 }5 } 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" _ R$ O" ~9 `+ U( j5 }0 [! S 2 F9 L" @9 Z; U: N8 `5 U
-l size Send buffer size. 4 a. s. O, W/ F1 ]5 J5 W
6 D+ ~; T3 j0 b- \ X' x, V 定义echo数据包大小。 |
|