|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
# x2 b i. n* Z6 C / C0 d, Y# C, O' Q/ f) \9 I" y3 \) l
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 U* i/ X% W! ]* u& i9 ^
+ f6 r. C+ k4 X0 q! W$ h6 L5 M( ^ 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
( K) A/ f$ I1 ?1 [0 w% k
: @ v) R) c* b$ F- C, | ^6 r; A Options: 0 w% J3 `2 \& U$ J, R' a# Y
/ ?0 t4 C+ m0 v& f -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. Z7 G: d( ^- c* G; }& {" B# K
: P. M# i" t% \- e$ I
不停的ping地方主机,直到你按下Control-C。 ' ?# A. h6 c3 g
0 _: l' o) |) F2 K( M# y0 e 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# F9 `6 K; K- r- ] " g5 p; e9 U/ L! a) n( O( n
-a Resolve addresses to hostnames. 9 {5 d& F" L! Y, k3 s( @
8 Q9 [: |+ \ F: Q
解析计算机NetBios名。 , }" t' H2 i; f) V. T" [' G" t
0 h1 b3 C( R/ \6 ?3 C
示例:C:\>ping -a 192.168.1.21
4 K0 n5 `5 C( N# K
' J$ [5 @6 c9 q5 Q Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# V5 N+ {. g5 |6 O% w ]$ V + D+ I7 A" s+ `! s+ e3 B1 t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & H2 K# I8 s, |. E0 M
- d3 V( r/ w( G* K |2 e0 y2 r Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : J' n- @9 g* l0 e' F' D1 n s4 g# D
% X1 u" }3 U8 G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , g, V8 y1 o: y/ O6 G
9 [" c5 ?* ^6 w5 z ' [5 r% ~' R! `2 \1 O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, \( [) r6 M z. {) d: A3 a # i1 E) E" d L) Q: j e* N
Ping statistics for 192.168.1.21: " J6 L: ~1 t3 p5 P0 W, ~% P
6 @/ m. ^# S/ t6 V5 E
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
9 [; m( n: ^8 T0 |4 S9 F( M + \" Z; m: @6 t( {( u
Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 a) L' m2 k# e, ]
; y& `% a+ L% I: J3 t5 b
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
) _# }/ K# Q/ o7 w4 A. T; |; W+ | # c( q9 n# j. H1 z4 U! Z, b
-n count Number of echo requests to send.
) K0 a3 V& Z& C; O
! u+ Z5 }( D+ e% t1 h0 F 发送count指定的Echo数据包数。
1 G1 f, P+ {) t% R% Y 5 D; `: [" y4 A1 u
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: , {/ q- Q u) r( [4 N2 s0 \
+ U! d6 }" K6 v/ n9 p C:\>ping -n 50 202.103.96.68 4 n2 B+ ]7 d; S4 A$ Z( U
$ |3 s; |; X1 T, n
Pinging 202.103.96.68 with 32 bytes of data: # [1 \- B0 E# u
" x9 {4 r6 Q+ S `! e1 K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 }1 ~ U5 V: L; s% t- P& f
[! X8 h# Z: o% W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 I9 o. z, @, L % s7 U! L1 C4 e+ I: } w" x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; I3 X( f5 X; d8 `; ^; H
6 k* `: Y$ r9 {6 ?. T- F Request timed out. 0 V+ \9 ?% ?' m0 {/ u) W
0 Z2 w( D& l+ G. J) W4 K" o$ G
………………
( F$ i. O3 s! c) J
0 W% W- j' w* S" |5 ]' t Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 R3 |$ J) i! T: f
3 c8 \) e' L5 S' f) Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 _6 U5 s3 D1 P , @+ {' f# U1 f! G( y
Ping statistics for 202.103.96.68:
6 |1 ?) W- V, M: u0 Z9 F i) j% l : d) A- V8 \- c' s6 {
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
7 r& t5 Z% v# k, K- X : X) m1 P, I, T2 l" O/ E( {
Minimum = 40ms, Maximum = 51ms, Average = 46ms # Q9 {6 S$ e* G. r% D Y! x& A7 s
% M# ?3 g' f4 {2 P9 {/ g I 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 # C3 f8 W: w! b5 b
) @5 v' V- m/ J4 ?
-l size Send buffer size. * y `# V$ a1 S8 `& b' O
1 X. ]1 [! d8 g5 T' l) Y# w 定义echo数据包大小。 |
|