|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 2 h3 X( x& B0 I( K
. v$ I7 I& p& S$ Y: u1 I4 y/ F# d 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
- W: o6 {4 N3 \2 W ) s8 v2 q }+ M" ?) m- {3 l! [
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
7 J( b- p- a& B0 ~( E
# z7 O- B+ h5 M9 O) i2 b I Options: 1 E" F( A; b( Q# Y; D
1 i& \, c( ^$ g# C# }
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% n; E$ j( o9 x- A3 c
( X5 j' n9 q) ]- H0 R2 } 不停的ping地方主机,直到你按下Control-C。 @" `& o0 e3 D0 B" ]1 d
) ]$ T5 o* M5 O+ G! Q* S* l
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
& r4 E) e7 ]9 @$ N3 T( ~ x # C% _5 A. }* f+ G2 Z/ z' `
-a Resolve addresses to hostnames. ; ~; d0 L/ x% ]7 h; L) K
& A1 ^2 J: |) R6 \5 _: S 解析计算机NetBios名。 * }7 ?2 |6 T0 d' G
/ X3 W% I! L2 ^. W4 [5 q 示例:C:\>ping -a 192.168.1.21
9 {# Z: o: h# y6 R6 j4 a- U ' C- j% F- v" z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , G/ F/ ]' Q# f# z! M/ u
3 ? n! a7 ^& _# T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # o2 b8 J) b. F1 T' y
4 I: E4 o: a) I$ O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & Z u$ K- h: N! M' h' j: s$ S/ O
' o8 M) t _1 ^, \# z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
G" l1 f- y: K
$ k- X* _, Q; Q1 j, \2 J, ?. T ' \, ~6 ]$ w+ ]' P& c8 }6 P' u- [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! y! a3 u( w. N; ^ O
$ q2 g# h6 a: ^" W7 |- g F0 e Ping statistics for 192.168.1.21:
6 \" k% o4 `! l5 K# K3 b7 Z: i 2 P2 m" w1 F4 _
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , w% M2 s, P: N. [
$ n- h, M/ v) |9 m2 g/ [ Minimum = 0ms, Maximum = 0ms, Average = 0ms
8 X$ d- b' }: N8 o O
5 M9 P3 l) H3 |. ] i 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
( j5 }2 ^6 K* y# j! O ?7 t * t# X( n$ O& n+ N4 L2 W
-n count Number of echo requests to send.
+ E+ ^& `( I& m/ u) D2 |2 h
6 {9 Q0 T! y2 j* ] j 发送count指定的Echo数据包数。 6 Z* [8 k1 W9 P9 c+ |2 @4 F' X% Q' W
: u% u5 `: v- {/ q/ } 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) d+ Z: b: W! z# J0 b% b o L
p# P& E! H5 L+ B# i5 [5 s C:\>ping -n 50 202.103.96.68 3 G+ \" {5 M# _
& N1 }4 N. }( G( {7 S V2 X J Pinging 202.103.96.68 with 32 bytes of data: ' a( Q7 H T6 S- n
4 M, Z7 t: d4 a- k* S; Q7 k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 F0 [8 b. `% |' T v8 d& ]( C- B# q+ ^0 x7 K9 O% D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * ^2 v" _2 U) t n: E8 }7 o. k
* o f" R$ Z9 m5 Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 G% G* v# n; C$ o" \
# h( p7 V. E9 _1 g" K/ l Request timed out. 6 |$ u7 {& b$ v, A( ?1 h U3 J
& y8 ?* t( D8 `5 j' |6 D ………………
1 `1 V. y1 [# }* U- I4 j ) c4 V+ o8 _7 u5 f7 ]7 D R$ h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( k. \7 I' e- G9 K
% V* ]9 o' x9 _! D) V7 ]5 ^$ u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 l, O. z" l: O# X ?
R' ?# }7 M- `* W Ping statistics for 202.103.96.68:
% D3 K' X) `* z& S4 P8 M
* n. C, L- M( p! P2 k Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
( N( G! T }& n9 h2 [9 d: ^ 2 s. O( \6 Y$ q, ^
Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 [5 L( d; u* e- M2 B 4 b' q4 L2 n: U& K
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 y7 @# z# m" _0 K, g) A
5 h$ Y, j1 S: j* ? h -l size Send buffer size. " F! g5 ?" Q) |( T' B
- W' x M/ U( |
定义echo数据包大小。 |
|