|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 " x0 @ J# q, d4 k( U
/ V6 q2 V; n. B! Z" U1 d4 H+ G 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: I A/ k& ]1 e; r4 a" K
K7 v- G! u/ {% d 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 : h T0 U3 |9 W. `5 v! p
) j; K1 B# c2 V" e" z* C
Options: 8 l& o! @5 g2 a' F
+ i/ z1 j' |4 k
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. % a: X# B( ?# ]. [
( v0 D: I8 ~3 m! O3 _/ ]
不停的ping地方主机,直到你按下Control-C。
2 J# e( R7 Y! l5 o: J
, \6 W/ M# E- p. J) A' ^5 Y' r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 2 e) ]; ]2 M" X
. n! v* p0 R) V! a0 z& o' Y$ F$ |, p
-a Resolve addresses to hostnames.
. a. t4 p5 H+ n5 w, H% h) a
1 F2 E/ ~3 E& ?' R' } t# o/ \ 解析计算机NetBios名。
# L2 } i4 Q* }9 g
1 N6 i* U$ t$ Y 示例:C:\>ping -a 192.168.1.21 1 ^8 C1 G" m- V: F7 \. p) Z
6 z# K; ?: U7 A7 k4 R: W: { Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
; G% N# x& l5 P: s2 f
; Z, [$ h* R) f: I- I* Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 h$ m3 h9 e+ U% e" Q
% ~1 K! g; e9 |+ }! r. k# S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 G2 x$ o# Y# g; }4 [$ T$ J) ` 4 }; d- b4 w$ K; K6 j1 ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. }& V: M3 @9 h+ k D) _/ {0 I" ~" U" c0 R
1 [$ R0 g- e \) n, x! _" Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 j0 S8 U+ t1 i. g+ J5 }0 `
0 V y( b/ ?; u3 a& ` Ping statistics for 192.168.1.21:
9 J% X9 z9 c! n b8 Q; l8 u# P
" @' B6 V2 p7 x2 m* f Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( P5 W4 c( ^% F, i/ C( j: J7 r
0 b" q8 g6 K* i8 y& ` Minimum = 0ms, Maximum = 0ms, Average = 0ms ! b8 g$ G- [* z; l" l4 ^
! l- a! X- L& F H
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: P% f/ z* \) |; Q) m2 w- f! e
- n+ q! W# h- P, t0 e -n count Number of echo requests to send.
6 U& @7 y/ M! N; [# S , e! t* r' F$ M2 f) A
发送count指定的Echo数据包数。
2 {" U ~* A2 v% j0 ]/ a
& c5 Q' n! H _! m# Q3 l 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! O' E: ~) f6 d2 Z6 F- ~$ B
4 Z, d0 E, ~; a' {! f C:\>ping -n 50 202.103.96.68 8 g9 a1 q; a+ Z; x$ Z" P) Z
5 ]9 @% y6 r) {5 V/ m$ a; C Pinging 202.103.96.68 with 32 bytes of data: 7 E4 V7 x V& L6 w
! o' ~% f5 J( u3 t. Z$ a e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * a- p/ M! q) o3 t9 E
& b! X( ^% x6 z) T1 i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" l' ?- G# m- [ # s( S5 X6 S, Q+ m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 {: \# F. A" X+ _
& f2 s2 @9 n- Z! m' S' D4 ] Request timed out.
5 O# _, t8 e# S 6 K* G8 ~5 W4 \6 | _, H
……………… 3 J7 d' E, o7 P I! R
( L8 A4 T0 @; D+ J' g$ O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . k7 S: r/ U! ?
2 H9 F- ^4 G' v {" d6 B; T5 p6 Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( y% Z& V. h& [$ J. I% ~
8 T2 g& D6 A2 w Ping statistics for 202.103.96.68:
) } y2 _; i! }+ f, L+ N. [
6 ~; h! y; B- r* Z9 e Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
! \+ t# v' \, C p2 s* k5 t
0 X* R) D& d- s" @9 | Minimum = 40ms, Maximum = 51ms, Average = 46ms ' `) ]5 M0 t! k) o8 Z! t
5 U/ n" p: W( b
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 k6 b9 y9 \* U9 \/ s! x/ \
# C1 J# v* a' g -l size Send buffer size. - d! c/ B' e% W! _+ S4 L' p p& q
" k: H4 G0 H, ]# Q8 a, n
定义echo数据包大小。 |
|