|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ) H0 W% b- ~( S+ N. B6 D* D M
% c2 ~- H9 E. f6 X' I7 X) x- o
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
: F& y- N) |3 j; I6 Z8 r+ B) q5 P % d% Y; \3 \2 d* Q. q0 P
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
' T/ h; k, } g9 c, z" |" P) B. ~- } ~$ M0 C+ b K) E; J L( U3 Z
Options:
/ }0 k) l0 i- F/ _ ! X2 f; x0 r8 I/ B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 ?7 ?2 c, L* Z. {% g4 c/ z
, h( R, V8 `- G/ R) X7 A+ W; A 不停的ping地方主机,直到你按下Control-C。
4 z4 v8 B, k& ?. Y+ V
9 ~9 E4 J7 X! o* @9 Q2 ]( k7 Z2 _ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 / s9 |5 c, h: Y( ~" w o
4 ~- {9 }2 I7 i' ?2 o x -a Resolve addresses to hostnames.
, `* d8 F; A, \ 4 n+ \( C2 }6 Y
解析计算机NetBios名。 3 U6 I: u R9 e
7 I: x& q0 L1 g+ V7 C5 c
示例:C:\>ping -a 192.168.1.21
/ M; o; i' ?* g- T c; u& g9 o" o8 W
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# w8 p# c8 i" v1 b0 S
4 t# k' x8 n, A0 f+ l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * Y/ n7 @2 g5 z8 }" I& ^
$ r1 ^! }+ k9 d2 v* ^% S% e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- Y* L! O) U+ ~, k$ m1 C 3 g* f% n2 a) V4 o3 {. d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / r* I% V, [2 F4 ?$ h
$ m {% c: Z. c. i 1 k4 c' s$ R* i f9 y- C3 R9 D' Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . |* |$ N- d! [# s- z3 [. y; k
: S! o5 [+ H' M/ y' ^
Ping statistics for 192.168.1.21:
2 w8 J% }* X7 z
4 G: p* ~5 X- E( T. S$ r! p! c% d Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 x) a3 R" d) Y6 \; }
& \7 [) h1 P7 m2 m t9 E4 }
Minimum = 0ms, Maximum = 0ms, Average = 0ms
9 R: L0 c/ A: W1 M5 D
5 H# h$ l M5 O3 ` 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * E4 P& `1 }" c; }( M
" T) i5 O* k8 \' G2 ^6 i0 K3 F -n count Number of echo requests to send.
G; L& c' y: v* s6 x- j2 F
1 R* j1 l) v0 r; ?& } 发送count指定的Echo数据包数。
1 I3 [) P% k2 A1 p3 b" d4 P
3 `! R' A y# {. T8 Y+ s 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 7 t/ R e) {( S! L( e7 `; x
: s, a: H1 l/ K) B
C:\>ping -n 50 202.103.96.68
0 P4 ?1 l+ A J& k' z! }+ l) o 9 Y" V4 C+ a% D1 @4 U
Pinging 202.103.96.68 with 32 bytes of data:
; y+ K/ T- d0 E6 q" h+ d$ A
6 ]- m! V; c- Y0 q4 E* [9 ~2 ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
p' J( {, L. X6 Z( M9 u. Q0 i9 T 6 l/ y6 \' j$ C6 b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : ?9 v+ ^6 o' i
+ _+ M* c J( _4 U; R- N$ L& o, ^# ?7 v& p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- \8 e) `1 f, H9 J8 \8 p& F8 A, r
. |- ^$ S( O( B Request timed out.
/ [4 y$ N- m+ I
1 M8 Q/ _1 ]' Y: \ ……………… . d5 }7 p- I% Y, _9 S* {# e
3 x2 p: \0 q7 C0 g6 |) n5 { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! b) z, c+ _+ K q# ~$ O . P9 q( B- F4 i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% N% z6 r8 O3 i2 o, J( t
6 S( A4 p6 L) z4 p% ?! p% \- j R Ping statistics for 202.103.96.68: ( W$ ]( u' Y+ v6 `. v3 ?* Q
' Z% o C) x3 z# B, X5 D Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 9 x$ v2 z, S" \0 i) g9 L/ t/ g
; T5 f- M/ u, H( E1 \. |/ C b Minimum = 40ms, Maximum = 51ms, Average = 46ms
! y2 _4 S$ h+ b; b 4 m2 R/ y# F: k6 P$ p% b7 V: i
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" [, ?) t; k4 _& G! Z2 o* ^
% ^3 o% w& @' a5 D) N# O# W -l size Send buffer size.
/ {/ N1 {5 O/ y$ | % m, q/ A3 E9 C/ C! g
定义echo数据包大小。 |
|