|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % @& V& z1 B. k6 U- |
+ H0 [2 L2 e9 _9 z( {
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
* G# k! {( s- {' o, V7 i 3 y) U6 U: n. W2 r+ ]0 H2 K4 G
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
' S. [" F9 ~, A" g) c1 {- p
1 B1 |4 X% O4 N3 E Options:
% n& p8 ~1 t) k% n2 G
9 T, _, x0 k) w9 {( f -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
+ d7 V$ S- G8 R6 {8 G1 k . {% D4 H! O" `; y+ \: I9 u& F$ c7 M
不停的ping地方主机,直到你按下Control-C。 4 U" j& e6 | r4 O9 U" k6 e
) o) A% a; c A/ ~ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" ~: X/ ]% h. S7 S* D
; D) @4 E2 \/ {0 s7 g% W: D -a Resolve addresses to hostnames. % @5 s- {% a* x x! l- u
* C0 r1 w# M1 { 解析计算机NetBios名。
4 Z& P& g k9 M4 a7 k * X& e5 b3 m2 x- y0 U
示例:C:\>ping -a 192.168.1.21
% a. q! M5 f5 H/ ]# Q 8 P9 G* {# }" ^! D
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
4 Y6 S5 ~8 x; W5 [0 f2 ^, I 3 F3 \1 N! e# U. `/ F+ |! T- R9 Z Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 x s1 T6 a" ~# `8 H
& V: N: D; r M9 U$ Q0 |% u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( [6 e# @7 \; D4 ^0 f1 x; f ' m/ b% q5 y/ `/ j9 ]( g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 Y8 O' a' b4 n5 }) Z3 |
0 O% }1 {9 J& w# C' A
2 r! t$ P1 ~4 T" s) `* K& A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* |4 m& ^: Y( F ( T$ c E! R& R. K( b1 ~7 K3 M) f
Ping statistics for 192.168.1.21: ( J1 D9 Q! p2 ^ L/ q7 Z
4 C, O2 j9 p5 p. s7 \) V
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 s* K# o$ ]' e
% h$ }2 r- Z2 J* F
Minimum = 0ms, Maximum = 0ms, Average = 0ms
" H, d' Q% Z: r9 n3 h' O. k
, a4 v- q/ V1 D$ W 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. [' G7 m" o: n. W4 c- b, a
- O4 W; ?% ]) z4 Y0 e0 X -n count Number of echo requests to send. 8 d. W2 c, k/ q! w ]7 E
1 M+ \6 ^0 ]3 b( a! u [0 @ 发送count指定的Echo数据包数。
# w$ d) K( N% B M5 i) A
/ Y5 p' [+ C6 S( {: a/ [% k7 Y 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: & k* D6 b W' T4 |5 ]0 }5 a
0 |( v2 E1 i+ S8 W) w' Z$ V
C:\>ping -n 50 202.103.96.68
, K% P& Z/ R5 o l3 i
/ @/ |6 c4 W6 ]0 f Pinging 202.103.96.68 with 32 bytes of data:
; O- o _8 P- j . r* \$ c$ t/ }# a1 N5 x8 O3 b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 b9 }0 `2 [( s- q$ o
! V; d3 M* u* N0 x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 Y) }& {3 Q5 t$ y4 E
, P+ o& {$ d# c n# u) _8 b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & z$ T4 ^, \; T
: K6 {+ k( y5 H% x1 A* S' k
Request timed out. 9 O. Q) \5 ?# v# x o
& |( ^' J! f( d ……………… 0 @* `6 W# D+ J0 C, b0 j- r& |
9 F6 d9 ~( Y0 [9 Y f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + l& X0 |- c8 d, ]
4 e2 n8 {+ c7 i9 t+ O# B9 f5 U1 Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 Q: f5 {& Q% F2 Z6 D / _( e' m* ?9 }- |
Ping statistics for 202.103.96.68:
- \/ C1 D% ]8 b- k. G; d % u5 e! ?% E8 e% T, |
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 5 n# @1 [, C& N
9 D4 s) Y( m. S" N Minimum = 40ms, Maximum = 51ms, Average = 46ms
: W% b {$ O$ D; x- V, f ! `7 f6 `( N7 [ N5 O
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : ?7 m. { A9 t# @
9 E4 _3 i$ i$ Y9 ^ -l size Send buffer size. % c# `; I, ~) C' \; F) W
* M; Z p7 C; `; {; K; Z8 _
定义echo数据包大小。 |
|