|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ f- [9 y/ I( N) ~3 Y
: v0 K. ^ Z8 L. t5 E, W1 [! R 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
: O1 u4 J( U: [- f" S
+ c% y6 B; Q- m# M" h) B* o 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 ) X3 }; F& G0 L I' x& R7 k
3 j2 Z3 W8 ?; R& h9 j# u Options:
7 U2 E% E7 O5 t* K( E 0 M" |/ w; ?4 [4 p
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# k% O9 w+ e8 E) ` Q! k5 z/ q 0 k; V. D8 ?& }9 P# c" A
不停的ping地方主机,直到你按下Control-C。 9 M! O! Y; I+ ?
# Z) r# s. p- M6 ~; C) }$ \6 Z 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 / @: g# Q* L; j
' k) o- a2 C7 b+ v6 v5 T
-a Resolve addresses to hostnames. $ |" B! T; ?- `6 Y
( U$ N' o. G0 l" _8 x, }2 ~9 L2 V) ~
解析计算机NetBios名。
: g# R$ \) ]% s
" h* v* p* d( s- @: M5 i8 r4 G 示例:C:\>ping -a 192.168.1.21
# d; B! y3 k3 ]
( @! x" v3 m7 a" e2 n Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 v& k6 d# ~- m: \
. O1 c& W6 _( y1 c+ g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" S/ e6 _- M, w% n
# k6 Y8 ~; J% L9 h4 V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" @) m7 S8 M# p0 G# y
' f+ D3 f/ U) d" m3 T5 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ s* u1 k' h3 X3 [
9 V v. A9 ?- D, X( C
6 A- Y3 y; @/ Z J Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : h' N* E7 O- v- m9 p& {9 Z/ a
& S% B8 q3 P" e9 \! X% W Ping statistics for 192.168.1.21:
! {( H1 ^$ ?& h6 ~; W( G1 v 9 J3 C k- \' A* ]/ r
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
- S1 t& V, l! h0 Z0 R; _
: O) e- a4 j Y% F/ U' C7 K, R Minimum = 0ms, Maximum = 0ms, Average = 0ms
% q& f. ?3 x W0 n Y / X E! T5 o) g* r, A
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # U, k I2 w" m0 w/ M) E
. ~8 o0 x# _ M: b K; a7 M -n count Number of echo requests to send. - I6 N. t5 r- q& s9 V
. H0 L" U) ?' L! y: v 发送count指定的Echo数据包数。
( F+ A. R( \1 d% G / i: @9 E6 P3 h; l6 U5 a
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
5 J9 j0 K- y7 ^2 r; r * k* i% h4 r+ J( C7 g
C:\>ping -n 50 202.103.96.68
1 c$ b3 b( u& D7 F6 s, M
7 s! Y5 d: E t Pinging 202.103.96.68 with 32 bytes of data:
5 I& y% [0 Z4 o2 ~3 k5 k& U ) W- @% o0 [3 p* O- h) f. e- h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - |; H& O L* e7 I- d
' X' X* e' s; f6 n K' @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 c( j' h: k0 I8 q; ?
% W0 \4 ?) Z1 a- @( b. h6 | Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / M8 v0 ]: y( X& j( ^$ j
# d; y2 g( A% O- j$ I3 C- e: Z9 S Request timed out. ! z% j: u& b0 L( \. G
* T# O& T* I8 V! o; v0 F6 M( | ……………… / _8 s. u, T* Z% J
* ^6 ~. l2 S8 \6 f! m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) S" p' q$ ]4 J w
/ J8 j: r8 q+ H1 {& a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 _* ?- |7 e0 ?$ p# w5 X4 m8 i + G' `+ A8 Y$ \1 z. z! ^: a
Ping statistics for 202.103.96.68:
' I, ]' c# n' e) {" G $ D/ @2 v+ A7 d" p7 a
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: / |& M& e2 I) p* t+ M$ c
! _& T- X5 Y9 u1 [
Minimum = 40ms, Maximum = 51ms, Average = 46ms
( C$ L$ J, P* e9 H' P1 M
) z& w; ~9 B9 A' I 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 P P) I2 I4 @" C- @) z
- f! q2 }9 J3 F* j u$ U; C -l size Send buffer size. + H0 `% f; f: Z `! b5 }. Y# R
+ F) \! W2 ?7 q& R) _& s" X
定义echo数据包大小。 |
|