|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 e' D8 B% r- J L$ h+ \; m* X4 C
: L$ K" J: o4 |& O3 |" H% I
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * _: g* u% D- o; D
6 e, e5 Z4 m; h+ D$ n
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
! ?& U4 }5 I9 `6 C$ n
L& s+ P' r, ]6 L6 j& W! @3 V/ K, e6 | Options:
3 D% U, U0 c* R
7 z8 i2 L1 P! d8 a$ X: ? -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 u: ~4 X2 T2 A5 i
) m9 i: F9 K: O" [" L 不停的ping地方主机,直到你按下Control-C。
1 d. |( ^! F$ ^5 R8 _ ?4 H
( ]# \5 l5 V3 U% F 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
; l2 s4 a3 N9 T4 a
" R3 {# [" h1 N; S9 D! c -a Resolve addresses to hostnames.
6 L4 n8 v, o, a+ F: ]0 b2 R9 p , s$ C* k8 {% @& q0 d0 e9 N, R5 U
解析计算机NetBios名。
! H* G( a/ q9 t+ P+ Y. T4 X0 H 6 |1 ]+ \' @# s. p6 H. b7 f( `* w
示例:C:\>ping -a 192.168.1.21
; d( k2 V$ M- q) I& l# g % ^; e/ p& T( Z3 Q6 @ G
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 e/ b% Q# o" Y7 k9 g6 x# r3 E+ R5 V1 |0 E
1 r$ D3 g$ t' g. V$ ?& v7 | `- g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 [, e" Q% b8 B5 b4 `4 T9 u
8 P) U6 U! T0 w. B, X$ Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 G$ i2 o- P1 L% p; b 3 m8 F+ ~& ^! n: q6 L4 q; ?# h: M7 z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , H% m' d& F! u
8 Q: i( n8 S1 O( N 8 k; X) I1 u" A) \7 T' {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# ?& U& H* b9 _& n0 B! X* X
, x. M D6 o1 ?" ]% m x) u+ H3 d8 [# i8 N Ping statistics for 192.168.1.21: - c) x/ Z9 t0 V( S
& W E2 b9 q1 c: i3 A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + M" h& l6 f4 ^# n: E; y) _' x9 g
- ]2 y. n6 ?: m3 e/ O* d! r8 n
Minimum = 0ms, Maximum = 0ms, Average = 0ms ' Z9 j7 c- C6 S `) }
/ f/ N! s& N; U6 Y( d0 d, }/ b 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 [3 }+ f! _4 \, H; G) J" {
4 G: c0 `/ Z9 X g) i
-n count Number of echo requests to send. ; G0 {, x# n# a% i; I9 D9 ~/ b
9 `# ~4 ?$ z* R' ^4 H 发送count指定的Echo数据包数。 . @ A+ K7 w8 R% |& r
9 F) X( a( _: o3 L) w 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 7 w3 m9 @' s- r$ h/ U( t
; q. P# M+ p5 A r# s8 C8 P
C:\>ping -n 50 202.103.96.68
% D) C* H+ V3 B; q ' K5 _, c7 u4 F. [0 |
Pinging 202.103.96.68 with 32 bytes of data: , X. I; ~9 \1 \
3 H% p% N: ^; q& G2 w* f+ t
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- N! h+ Q7 S! ~2 y* j
/ \, C1 m1 \+ H k7 g$ f: J+ t Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) F" k/ a" B1 ?! Z& f
& T) e, N9 [! D0 J! P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ a+ U% I2 }1 M
9 r% f* N! i b I, I Request timed out. 0 ^0 G0 G s H4 {- t% z# L9 @$ n2 b
7 b$ ^/ t1 \8 x* f# ~
………………
6 I; x/ _# c3 h7 t9 y0 ?& s& x" W# y
9 ~, z/ g8 R6 A/ y$ \, k) I0 T( f* m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ c5 W' E. U! D1 l. k
# L. {8 y: J# y" t$ m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
r+ v8 V6 w# S y+ _# L
7 d# k8 C8 v! B* j: f4 i! F Ping statistics for 202.103.96.68:
- w% a/ Q9 |4 H ) o2 l" p6 y/ `. \& I) L
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
3 ~" {) L$ L1 i4 X! ~/ m; T
M/ h0 K6 l8 f' n6 f Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ r) [5 c+ {3 N2 Y7 N# Q
, ?% P$ n. u/ c/ A k 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
- k+ B" n, a' s ^# f / ?& }* N6 L! [( K6 Q+ J" E
-l size Send buffer size. : x& t+ f# f( R9 e: e2 x* n0 D
6 v* ]! T2 t D8 w5 Q& O 定义echo数据包大小。 |
|