|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 - ?5 }. r U$ F% p: B
1 F$ X9 Z: O9 e6 }) H
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
- ^1 _6 H$ `! s6 U- V8 n " i2 R% z& @5 w1 f; 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
. h4 h# R4 N" \5 n+ ^1 r & W8 s. b: ^: n, H+ [3 B
Options:
u- S- g) R. _9 S: p6 a
. Y. m* l2 n" K$ ^9 u' x -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
+ _/ j8 ^& O* X! |" p1 S
( e4 O, u" K# _% K/ I 不停的ping地方主机,直到你按下Control-C。
7 F. J" r! Y$ K ( W+ b( Q0 T3 }3 j4 X# E: P
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 4 t' E8 d; B9 P, J, A
; w$ E) Z8 N8 c1 A1 g) z
-a Resolve addresses to hostnames.
8 B4 a' V; Q. B8 I) T
1 j5 a! x, \$ z' L3 `! r+ S* w- f1 d 解析计算机NetBios名。
* w0 ^2 ^' w1 b f
. \6 _7 l5 a8 ^2 w& E 示例:C:\>ping -a 192.168.1.21
# f! U: Y* s) h# H0 G # \6 @0 T: B0 G) W; n
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 X9 Z1 h% T; b
: b$ J; Q: H/ W" S$ a; ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# p p" {1 @ W, l) M- x + X1 X; L5 _2 ?, [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' K# v* o$ S% Z: l
* W. O+ h$ p( Y- D R: r7 b
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% ]$ J( j- i7 }- m n. l7 y+ {9 K2 |1 M+ p; X
, o; Q! x. u" o0 b; V! Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. W" C. w! U7 f
M7 D. d6 j% D. }: k Ping statistics for 192.168.1.21:
- ]+ Z2 y9 \/ S; m8 p ; V1 z0 `; t Z# `/ ]. i4 K
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
9 h+ C3 R' T# P6 z
8 M" u, g7 c3 d8 C Minimum = 0ms, Maximum = 0ms, Average = 0ms
- P- N& {1 ?% g: Q+ B+ m
6 e6 {' U5 _" C4 H: H6 [, V9 [( H 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
) e& f2 u* }, T5 b2 X1 V ; M; H2 _( ^9 C+ N/ X
-n count Number of echo requests to send. # j( ~& _* `8 a3 c5 O0 R
+ A7 S9 M5 C; a
发送count指定的Echo数据包数。
8 ~1 d( r# e6 f0 T/ [
" [0 y% a5 ?+ Y# {& f 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 5 c' t; l/ V& C. B& Q m
* P( n, j3 m3 p& i y
C:\>ping -n 50 202.103.96.68 3 P, ^. c; M2 y# E' B
3 O8 [" X2 c5 F1 T/ h
Pinging 202.103.96.68 with 32 bytes of data: $ v( U5 r+ N* V, q
$ I4 k u8 O e& L+ Z# B6 V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ z ]; E9 P8 E8 v" ]( e9 ] 5 e5 r" }7 v! N, L& f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ l$ m* j" A# m! Y9 {. k! {% | ; K( \# ?) e7 ^$ x: n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! ~2 Y5 w z a. I+ r8 w7 m
9 \) }! P! u5 `: @$ Q Request timed out. 3 G* W% _! P( @$ A! \
' _: |; I u, O: P) l7 y) k ……………… $ D ^- A+ z+ s( n& H/ D, v7 T7 Q" x
+ _. b$ f1 }8 v& a k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ u4 v$ f$ f( V6 r: l ' s/ @5 x6 D. L2 j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 J; M) s6 p7 k3 U5 | }5 L
3 u6 \. u- n+ s+ `0 j, Z/ { Ping statistics for 202.103.96.68:
: O3 d7 `+ `2 S# u 9 ^2 c5 N: I" F
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
( M ?6 ]! H q/ C# e
/ F* z/ Q' z1 }% d& C) ?$ W Minimum = 40ms, Maximum = 51ms, Average = 46ms ( Z6 t6 k. e D3 u
1 Z! V& J, P( n
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, E& q" L/ E2 b. n& d2 R' a( i0 I
+ z! x- y# Z2 E. y/ M6 \/ t' o -l size Send buffer size. + T6 W4 }2 r/ D2 u
% |+ ~8 v7 H+ A f- k, R7 K- _
定义echo数据包大小。 |
|