|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 C7 p6 d% W3 K! z* ]- J( a3 }
# }/ B4 _3 k- a( V( d 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
+ s1 M! ]% A9 y/ y6 v/ @6 [$ O
4 x/ u1 {1 ^9 C6 _ ?. ~6 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 5 Q; J9 v! K2 `6 z3 j7 J
6 z( W- u2 h) R3 t7 p Options: $ R2 D& L4 N8 Q$ _, M; o
k( z- H. ^4 o
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
; {- Y( p' X" \ " \5 |3 r. G G8 l5 K. I4 g
不停的ping地方主机,直到你按下Control-C。
* B6 j) a" P! n4 P 5 S" K4 |1 k. V0 J
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 2 @$ [+ C! v/ Y- ~4 j
( |" p, U2 I8 D& C8 n2 {6 E
-a Resolve addresses to hostnames.
, l3 U- s1 d8 ]8 u4 L' U
) E* Q9 G" m0 Z/ m8 [ 解析计算机NetBios名。
, j3 o4 u/ S1 q. O- M3 N 9 ^! _1 D. O% J6 n/ I
示例:C:\>ping -a 192.168.1.21
0 o" B! K# |" w5 K8 n: S0 M; b
. K8 q8 F: o2 R( d4 a" E& U1 F Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
9 q0 E& e0 [. e" H: p' }4 U9 S 1 m( P* G. n/ l' l
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 `8 Z% F# O9 x% z+ m% ?" p& N
5 D- l9 {! _5 s# O* P# L4 V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( m: A' L- v* L c/ p/ I$ D* d! j: R 3 Y* h9 F) |* A: ~; U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % E, G5 b& G4 V+ n9 B" R' A
# s, V/ P6 j N& E
) |# d3 z; n! J2 Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % l$ v: t# P6 w+ A3 }/ i' P2 k
4 [+ s! ~5 D, c1 A D: F, ^( G: B Ping statistics for 192.168.1.21: 6 M& _' l: e. ^# x p- T1 n) v3 X# ?$ c
- A+ W5 ^" g4 v4 ?3 o4 T
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 L& T; w' r- K" a# r) S2 O
8 I- k7 n9 i8 ^8 i7 E0 n
Minimum = 0ms, Maximum = 0ms, Average = 0ms
; V1 e6 e t5 T
2 d4 v. }/ H( g; ? 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* k, L/ O2 {9 @; E
, E$ }( b2 L( n2 X* B -n count Number of echo requests to send. & l- M% ]! [2 ^3 n9 t
/ B' }. n/ k4 H4 h7 Z4 G+ i
发送count指定的Echo数据包数。 . t* X; { |4 w! H3 ]% S% i. b
9 o8 b% o; ^/ y0 U 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- g% d' @; N" ]; t( u0 @1 Z 0 Q& D$ r0 A/ f% O
C:\>ping -n 50 202.103.96.68 ' ]1 i: T7 c' R7 {! k0 N
. k& g) ?; |; i) W9 ] Pinging 202.103.96.68 with 32 bytes of data:
8 @( P1 t7 b+ w! i6 X( f B, V
9 S" d, a( X8 X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . R. [ w+ D% ?% A# [8 E# n/ M$ |: p
# U+ f' Y$ R8 }. e1 N5 O0 w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 ~" Q) b6 F. A) d; V8 a1 i0 g
6 h* J- c) W# w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : W% y, e. e+ k% [
4 O9 a, J6 G, ]: r0 m% { Request timed out. 2 W6 h |$ W* {& I3 W
# Y/ ]) N+ F3 \6 K7 V ……………… 5 V# C% N5 [2 F8 v3 p# z
8 w, E* @3 i- j2 x+ c+ ^$ y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & k1 \! @. I; Z
" O9 {. z$ ~! B* F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( J: X3 U7 }6 I/ d
) r8 j# }2 ?4 J( y' W Ping statistics for 202.103.96.68:
9 ?. Y4 Y$ _5 L' L" |7 P* t- c
- \+ x- p; n2 z0 Y8 r, s$ P/ T Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: " l' c; G# I6 {7 l3 y! P0 ~
; X, D1 o; X" `: u! P" J% y
Minimum = 40ms, Maximum = 51ms, Average = 46ms ) a9 Y: I& t6 B
( z2 t F: ^4 V
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
4 x3 E* j5 |) k7 h1 c* |7 p+ a
M: C1 T u" l. o -l size Send buffer size. % Q a7 P4 A x
' L* H" h- N. x2 z: B) `# v 定义echo数据包大小。 |
|