|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
( r) j! }3 u: i1 h 4 E# `0 i, s" Y* w. ^6 E' h. D
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& {0 o9 ~5 U' q2 V
G; K5 `% n9 b" K5 } 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
; K; K ~! X4 E* w( E
, h/ T. l5 q2 Z Options:
3 f+ ~7 k& j* @ ( H. P+ N& `2 j$ j. g( @
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) ` }* i& S7 {: D: Q" y4 _8 r
7 x$ P# }. e7 G5 j 不停的ping地方主机,直到你按下Control-C。
/ J( G* Y0 j: `6 J5 ?* v. e7 d
" q3 }. s$ P" U" A' T2 ]2 b- y' n 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 7 o& Y3 p+ o4 b( X; U
, g4 p; S+ B4 V" L$ Z5 J/ ~ -a Resolve addresses to hostnames.
! o( P: T# Y( q+ o4 H # ?- q( K0 K$ }7 W
解析计算机NetBios名。 8 z Q; I; d3 q7 [8 M4 _7 M; c
% Z) m, Z' o" w. F" M/ C
示例:C:\>ping -a 192.168.1.21
4 x0 b, `2 j6 d% [
; M8 a, ]4 D: t3 h! ] Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# ]2 w# Z6 z' T1 H: s: K% f8 L" d
3 N+ @# l+ x7 n6 M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 e( D; ~- c: h! h
$ {( }" R3 Z/ z: c7 |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ u" }1 o) Q i. U3 j/ G0 ~ / C# ^+ N+ G8 s" C% @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 @* }7 u. i$ y- j( \" `, X: ?2 c# t) E$ p' s) ?3 O! q5 r+ h
& I9 p9 _4 L( z `5 n' \ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 g( ~; Z; X8 W
/ m, y% r5 J) s8 b% j3 X Ping statistics for 192.168.1.21: 8 K- l: M2 b* U( M% u
$ V5 u$ J( o% Y8 n& B! |
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 Y* n% i/ H! i6 S8 F+ _! @ + c; ?2 {- n! T
Minimum = 0ms, Maximum = 0ms, Average = 0ms 4 e5 ?* i' n( w* r7 z
; i* L. l' ^0 ^) k) d: d+ T5 W 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 : _ l' c, w- @! N- B
; [+ n4 ?! u4 ]$ n2 d
-n count Number of echo requests to send.
. V) w) u! b6 M: x- W" M ) Q I U7 t! _3 H( \5 C7 m
发送count指定的Echo数据包数。 ! o8 l5 e, r- K0 `( D, A
) o. _# P0 \5 e `1 N* q3 ?: i Z 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
+ d7 y r" T/ d1 X6 i8 ? q
1 C1 I& Y* m4 W; n$ }( C C:\>ping -n 50 202.103.96.68 # {* H& B, N! Y' i' y& R7 P, j
W2 G( Z3 N; m! n; l8 `. I Pinging 202.103.96.68 with 32 bytes of data:
! b6 t& d) C+ X7 p" v
4 W: b1 X) z# |- g t& X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 l4 g' c% p5 D/ h9 @6 g' ?- {8 p
* x6 v/ ~7 R# V2 @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. ]2 A6 ~% W. ?1 T 4 S7 G I& g* [; H) S8 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& {6 K @6 m' C, S M- N : n/ p: o b- f7 C( ]7 _( C
Request timed out. ) a1 n. D9 s' l! l8 B
8 [8 M$ ^' q7 o0 I
………………
# g( X+ ~: K5 |* |6 w : K7 P# H; m+ H- U4 G' `, v! I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: l# s3 b( S3 d4 y. F. j4 o" T
9 {4 w7 _/ K/ D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # t# J0 [. K, q U |/ `8 l" C2 @% B
' t1 \7 ^# V$ V; K, q Ping statistics for 202.103.96.68:
5 k6 \+ u) j0 E. X' ~ $ ~6 A% `% R& _5 L! ?* K
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # F, ~1 S- P* h" ~
$ E& m4 h% f Q; R
Minimum = 40ms, Maximum = 51ms, Average = 46ms
! a, i8 N4 {6 b8 @4 E 4 }0 W9 f% { X; X
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
# v/ \& Q- S; n; @8 a ; T( P+ w- h7 s) b r4 c" H$ {1 A" ^
-l size Send buffer size.
m: o& e9 n6 V. w: n
5 K. C- a& j4 W4 F! \8 ` 定义echo数据包大小。 |
|