|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
5 _5 y$ r6 k- a* I- p ! i) j; i7 i% l3 J# @1 V$ [
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( F, g6 [8 X, ]( E* {5 {9 [# _$ s L+ _1 h* j9 Z" [: u- n. E
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
' b- w; S+ P) J/ C u : k. Y7 @; G# J! ]+ o
Options: ' z6 N% G3 M8 j( l$ h2 d* S
; T0 O5 l8 {8 m+ }' E& c& O! H$ w- N
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , G- k/ w- }7 _. P
4 {+ G: B! _2 b# E9 G2 \# {. @ 不停的ping地方主机,直到你按下Control-C。
1 b' c" d7 G3 W! S
8 y1 B7 [, D3 N! x B( m# B, W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 + O5 U9 P# n8 h) K3 l* ^" u9 ]
7 m3 e/ ? Q! f% L6 u A
-a Resolve addresses to hostnames. ' Y2 l. Z& N; c p$ s/ F2 e
, e" d& W2 J- \: v0 r6 f3 s' r 解析计算机NetBios名。 . S: `4 S2 z, v- D7 w; {4 S) A+ H
9 q: h5 l; }. s5 Y 示例:C:\>ping -a 192.168.1.21
~+ R. q: m9 h7 u( P* q7 J 6 d s% T5 M* R- y& |2 \* D8 ]
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 1 T) t( e: [: c# ~1 N8 j
& @7 q! w1 ~0 _$ A1 {( s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 X, N4 Y& v9 R9 U1 ?: f6 j7 } 7 w1 K7 x* F% M& ~4 @! B6 U6 ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) z& r, `" r0 W3 L: w) b% Z. z
9 p. ^5 {. `: m3 N, J3 B. D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 R. u8 S: K. R! c/ u6 `" n7 k- _6 P& j0 e" v
; k5 |+ s' K. W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : e1 Z2 R0 s4 K# L& d1 Y2 F
3 a$ S- K+ x; E% w: j/ K
Ping statistics for 192.168.1.21: 1 G* U' O6 E8 H
, _" L6 _1 i f# J0 [ K7 | Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; j5 O$ G6 |$ j, G* f6 Y: O, { & l* c, b$ Q4 k- `# s2 V
Minimum = 0ms, Maximum = 0ms, Average = 0ms . D' M4 Q9 T9 b
7 r+ b. M/ o- {4 r2 z* ~ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + M$ ]8 B" b: K/ i+ s
$ X" \, G! L# ^5 M v% z% n
-n count Number of echo requests to send.
! `. C C$ v! I, P
& Z; a. X1 {* |) i$ I+ Y9 H* W 发送count指定的Echo数据包数。 - g, Z p& b" b. o1 H4 H8 i) i& C
/ j' R' ^) p& Z5 v8 |% D 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! C2 S0 Q+ l l7 r9 [( I/ D* d* t + G0 L. h( Y8 A% U- b
C:\>ping -n 50 202.103.96.68 ; N" V$ ^ \3 M0 D; f, E9 u1 u+ O
& a5 e" K2 d i Pinging 202.103.96.68 with 32 bytes of data:
9 F# x# y( s- Y# q" p - Z3 A* Q9 P' G$ q. Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % }* p7 [, S9 G
+ l1 }8 E" L$ u% w: o+ I3 X' v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " ~) @7 K- }: K" _# ], X9 H
) ?2 o. B9 [7 Z. _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 P6 b# O) X/ H
3 b6 @4 m6 P! |7 X Request timed out.
+ _& H6 r& \+ i5 U. A: A2 z0 [% { & ~: b v* \: k: q2 K
………………
' f( c3 [' y+ K" M 5 m) A& ~1 N. C' M: h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " C, I5 C& v! n
- z& [2 P& j0 V' D2 Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 \0 ]. P& H2 B- A5 |# V
: V' G+ o6 w8 Z, A+ W
Ping statistics for 202.103.96.68: ; {) w# Z6 ^0 h. j+ J! Q
" W( e( l# h' a7 x7 z% m6 K* l Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 j$ S2 I2 M" U7 r' J
7 ^' h5 V+ {6 E7 b x% j i Minimum = 40ms, Maximum = 51ms, Average = 46ms 0 m4 {. \; A3 P3 F" ~
+ t5 B2 A, n" i3 h
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 8 r) F) `7 u1 K, ^" Q8 P5 Y
7 l2 J C4 ^2 R# t0 P
-l size Send buffer size. ' b" r8 T* T8 l3 a1 \: M
0 [! l( M! W8 I3 |' l
定义echo数据包大小。 |
|