|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 q9 w- f D+ ?
4 g% [( o7 K2 ^: F$ I2 | 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
6 x8 ]' n, H" s! g x. \2 f6 [7 Q
0 T: X. y+ k# h6 Q$ 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
( e4 X6 R5 z [" H$ c
! [1 ?1 u6 I% A4 Z( G Options: 4 S1 g. c; g2 u4 v6 L& _' A0 }$ M5 T
: P" Q" j! T8 P' L
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
! `# H1 I2 a4 K3 \+ I8 U+ K( A
9 }3 U1 F9 }' E- }% u 不停的ping地方主机,直到你按下Control-C。
5 d5 F w; o: r9 p! S% s
9 x$ g: K; {! T7 a! U 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 n( h' p, W8 K6 B1 `( @7 a" u
# U5 T' ]+ x: B7 [3 d
-a Resolve addresses to hostnames. " w' \' o4 h6 p9 i: T6 d+ ?
* d. s/ d4 a: O+ d4 }% {
解析计算机NetBios名。 9 P4 z7 w5 _2 u: z: M6 _, I
: x6 F. j% y, c% e; z5 m& E0 g
示例:C:\>ping -a 192.168.1.21 + W- a3 J# ^ Z3 d
0 K* \; C( j; ?4 m$ _0 C Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
/ U& Q. i' W- z5 m v 5 w' A- H# k" q9 ~# {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 ^6 @8 |: i1 i
8 X3 `8 q& R1 b+ Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( t6 h& L/ t+ b 5 U, W+ l6 K& g: t9 T7 T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( e4 ^. c" ?2 l4 m; }
8 V# a" ^3 G# _) E/ ~
5 f1 W6 x, k6 X: B% y6 T1 K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / i& v, {$ x; V' w6 j; u. c8 [
, ]9 F# m W( n1 n
Ping statistics for 192.168.1.21: * {! c9 r6 `, R6 L4 {* u
' l n0 B O, \4 I* k; j Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
: l$ |8 b+ T) {5 ?8 Y! Z' j / A/ M+ y5 C: g7 H# S
Minimum = 0ms, Maximum = 0ms, Average = 0ms
( q2 k2 A' w$ h7 Z2 j Y, Q, T
7 i! h0 U9 k" O; z0 U 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
3 A* S& l0 w: X: L7 t) I
! B9 c$ t3 |# V+ X( N9 v- {; v -n count Number of echo requests to send. " J0 V J# b# B" ]
3 V: l$ H: F; q/ K3 b: i0 T( e$ D% H3 F 发送count指定的Echo数据包数。
& p# M+ C! S+ n" h% C. _: c " f) q" A, X. M% P; ]
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( D9 D& `. ^) t( x& i / M6 q' M: h" V, M4 H# ]7 R
C:\>ping -n 50 202.103.96.68 2 E( M# G+ }. o! U) }
% A% G0 H* O& G- V k D
Pinging 202.103.96.68 with 32 bytes of data: 8 v A9 d8 ^8 _) ~
0 q5 _/ r3 p& R- _6 ^1 c! z" x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, r" s+ b; B# {8 g1 w& f
% h9 ?" H4 O, z* p1 d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , L& g% m/ n* ~# A; s2 u/ l
5 C! ?4 J7 J+ M8 W" R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) O( D) v3 n3 H
. o8 V0 ]. x3 V Request timed out.
; a2 X- Q8 P3 B8 { Q9 a/ H5 K
& Z' I! J5 ^2 V' _. F ………………
. Y9 Q8 |" u. I* v8 p8 e# e
`: n3 m1 \5 x0 Q& N. r6 n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 s* x+ W- B, v$ J$ {
. f) p, Z; s' j/ x7 R7 I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 W8 z3 T! \/ `6 @" c& S! U
* e: K+ m+ _; b t6 [$ J' v& v( H Ping statistics for 202.103.96.68: 3 d5 y R5 B* E' L' K% r$ N# u4 m
4 o+ F7 g/ U5 A
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
' L9 r$ A* X$ {$ H, g; h( g . N( x6 }7 v: o
Minimum = 40ms, Maximum = 51ms, Average = 46ms 4 U" `/ ~; ~, U4 j0 a3 M
# _6 ~1 Q6 S4 L3 ^ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
' r$ G& g C7 b% r0 K; S- s; Y
# C( z% K& R9 w- N -l size Send buffer size.
* }% f1 Y- G" l) ]) U7 | + }+ a; A5 ~$ y+ d
定义echo数据包大小。 |
|