|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % \8 V1 {) d& ?
$ w2 j9 ]9 q. C d+ D 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: % b$ \% F* V8 \& t
0 I" |5 ]* M3 x- ^ 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 0 R" W+ ^* d& S: T3 P
% @& K' s( Q8 F# D1 A2 I Options: 9 S: j/ \; ^, a$ s! I
" H7 u& w4 @3 I! E! k3 V: s+ i! n -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. * B8 [4 V* ]: y7 o; ]- V* h+ @. _
( _ p% Q2 P$ e( t* C( @' P% p
不停的ping地方主机,直到你按下Control-C。 ) T' y6 a: s2 F" x k# l! a+ e
' h6 ~4 d+ E# J3 X5 ~0 s( J
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 + {& k+ c( z& t: ^( ~
( I9 {( l1 B1 ^- \2 H -a Resolve addresses to hostnames. + Z; R# y; T" d
2 a' w& w) {: T7 C) ^- b5 c" p
解析计算机NetBios名。
- p, d' l# W5 O4 `1 U2 y
" Q ~1 P* `3 \ 示例:C:\>ping -a 192.168.1.21
: ]- l# g1 G- H. I, F. h
8 ?- O9 f' g+ \3 z Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: . }2 }! H+ Q/ b7 B) t- ~9 h% w
& Q: v( ], Q& b& u3 Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * J$ N' L) A9 j6 L, _& E0 Q% e
- W! v2 Y" c; x2 O m$ O& n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 j4 j2 e4 }5 e5 \
7 g5 u, l/ G4 v0 ~! o5 `0 J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: Z4 P: x2 ~ n9 A: U/ |+ v: F
( m" z' u4 K+ z+ u2 V# Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # O# V9 y9 \: D4 L F, r
0 X+ ?$ E1 q/ m% J! p7 `. C Ping statistics for 192.168.1.21:
. }7 [$ I# S: ]- H * Z: F+ u5 e- F8 d, d
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + @; ^ [2 j2 v. T
7 g; P! V' i/ E. ? Minimum = 0ms, Maximum = 0ms, Average = 0ms
! Q S. f: ^ F: s0 U E* l$ A# m4 G4 j4 U# Z8 J
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
% e/ x2 Q/ p1 ^: }( g) c6 `1 Z
) b; ~6 E4 L" j9 u! _' R; i9 ~ -n count Number of echo requests to send.
+ s7 \. @1 \/ G9 ?) s2 U" S
) m, K0 N) x6 ?0 j% Z 发送count指定的Echo数据包数。
6 |' i; ^1 O, c7 m C% F
. \2 C" ?+ c8 }' k8 S; c, K; p 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
9 V) |* a" O9 f/ s- Z
2 k) b- x- G5 p$ N" ~( X C:\>ping -n 50 202.103.96.68 + `. e( |! @( g. h
- ?6 j# N4 N, D- u4 \) V
Pinging 202.103.96.68 with 32 bytes of data:
# R2 A' Y$ F8 d* n
% B, n$ G/ r; N7 O3 R6 {3 P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 Q0 ~0 O1 R3 w8 V6 [
! `4 D, J$ Y8 y7 w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 ?/ B; [, V( I- \' G" Z
' n |; W9 g; Q0 T- S/ l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 Y% R$ @ F: M 8 b0 T0 D" M6 j5 `
Request timed out. : Z) C1 y1 E4 q6 ]7 p- n. B7 r J
+ @0 U1 V* i4 ?2 s3 ? ………………
6 n" S4 h7 B: T
0 @* \6 `( Y1 n% |; O6 C1 O. |, x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) W' p" q* I6 F: p# k" V! X
# l9 p) m7 J: b7 h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# b0 z: _+ B5 L! { 6 n) o, N1 n$ b- @( z
Ping statistics for 202.103.96.68:
2 A! a0 ?! \" Y" Q6 v # m; ]& D! E) u2 B
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 E7 U0 G0 {# J n! a
6 c- J- ? L6 c- J Minimum = 40ms, Maximum = 51ms, Average = 46ms
: R' o; ]/ w4 }$ B$ Q 8 B, L+ |' y$ t; D- ?( b
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, F; y+ ^7 ?4 z , w0 y1 k5 f, y* I
-l size Send buffer size. 4 x7 W5 Y/ `; `) F/ B: @
+ _( K" C" p x; K
定义echo数据包大小。 |
|