|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # Q P6 J" E0 o4 Y1 @' k1 z4 i) {4 [( x
% e Z q: l/ O9 e
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 6 F8 J' a- T8 ]% h9 w" g
' i" `, x$ U. U9 D' j 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 : L+ ~7 k+ u T6 d
% x5 j1 s( \' Z; u9 a7 i* ~
Options:
' ]! D: ~; n+ W) H8 E+ y
1 _( U: L/ L, M+ E2 D1 s- Y1 k -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
& C: x) c6 v2 _8 {3 }, d9 `7 i- e * p1 x/ ~4 R# Q$ ]& }5 l& h
不停的ping地方主机,直到你按下Control-C。
+ Y6 ]2 n, J) ?4 D' |) ?0 T. } $ n( l j6 A) Z* r
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) j1 J2 z+ u' Q3 w! a " j2 _% G9 r i! H% [# |& g/ R
-a Resolve addresses to hostnames.
1 V* O& K/ f+ h8 m. F* n% G
k' O& Q. G2 e- b# y- u7 \ 解析计算机NetBios名。
% ~& x9 W' R+ Y' K2 j8 q! _, @! Y# ~9 c
7 o9 b3 e h' x6 E0 X) _ 示例:C:\>ping -a 192.168.1.21
. V4 ?) ^; u, i6 S2 T" U5 L
( p2 d6 z7 F- E- M Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
2 Y4 C5 x g% X, d% r3 b3 a1 \; ] 6 y. x" F: _/ y5 l) J3 s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 N9 W) k1 E; i4 P' `4 c- V% r
; h# c% `& b; z5 u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
c3 d0 A( y0 m: n 5 t! S: l' M n* ^5 h' `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! s6 B# x: c7 K! a2 A. D) c
?" w$ q7 y, h) @
" u$ e- T3 F0 k" t' p: ~- n& c8 n Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ ^1 Q5 M& P1 d9 S
5 F( W& [7 H3 ^; W' {. o7 A Ping statistics for 192.168.1.21:
) p! t1 X0 l9 Q, @# s* G d9 W3 D - ^6 z6 C9 q: a) P5 z6 d* }1 L3 W
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: $ {$ w3 [; q* k1 y* l: a
6 S) @ |) D7 v% l; j% D Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 }2 r8 e6 _) X: u9 [! I$ I/ Y
/ h- @7 |/ `1 ~$ l
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& A4 u3 D# _6 o
& ]& I7 a. m0 u -n count Number of echo requests to send. # I; g" u9 \1 k4 x. u
$ E# p* ] O4 m1 j8 f. J
发送count指定的Echo数据包数。
& t$ ^' W: n2 t+ d# h9 q( U / J9 M8 F4 r) M! L3 |
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 4 ?' N. j4 p( M, A
& |' f2 O& k! ^3 o/ ] C:\>ping -n 50 202.103.96.68 7 u7 {2 l b4 a6 c0 V
, ^3 n, b% F+ F. q6 G |% l5 U9 ^- C Pinging 202.103.96.68 with 32 bytes of data: 3 v, r* U+ Q" m
' j& T: q F' X( X4 V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 t6 C, {; E! Y
& U$ }1 x# D" c6 |, h3 a/ @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" \! W( E$ o N7 C ?
- ?0 W6 @9 d, Q, g( E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " F; S7 x; _8 A. \; E
" y6 e" k1 y m. P9 b6 a3 o* D, y Y
Request timed out.
* M: R9 m9 R$ K; y
2 P4 ?& [7 k2 q% r0 {- V/ R ………………
- z$ F# P T; n F; o& h! @9 \
^+ B1 W- M) k/ D, c. { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) ^ ?- \9 @8 v& O6 E: ^
+ V2 x( p' Q- a: b. u3 _; C- O$ \ ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 B- X9 q+ g$ J, P. H ( Q0 k5 d5 b, K4 o7 i
Ping statistics for 202.103.96.68: 8 `' e& I+ @1 A4 Q4 Y& M
9 P$ h3 L& B' z: _( B4 R) B6 A
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. E6 I/ C# X1 G. u 0 s4 b- p0 G1 F9 ~/ _
Minimum = 40ms, Maximum = 51ms, Average = 46ms 5 I) R6 J- @& D' Q4 c
8 _9 m& b: s" w" ]& ]) _, ^0 ]5 o5 ^
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
2 J5 T" t0 Z4 C) S$ L! V# V # H9 }5 w1 M" W9 b2 P6 B; b6 }. O( q7 U
-l size Send buffer size. J$ r+ S6 C: u+ X
1 V$ r* W7 A# `% r1 M8 ~7 ^7 U7 z
定义echo数据包大小。 |
|