|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
" \9 l, P; Q. E/ A3 k; K8 n ; J: R) }, ]2 K% R9 |" I$ {
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 ~' U1 C. s: J& _5 e4 Q4 k* i/ s
3 [/ |7 D8 v n% ^/ \9 R 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
) y1 J& ~% i8 O5 B1 B }, _# m6 ?
+ V6 J- t6 u: B/ X. D# C- v Options: ( R4 @" R$ q0 N9 f8 x
( n+ M4 K6 u: i1 i% V: @3 D -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ G" b, C% ~2 i& G, m, V; j* V6 J
1 B Z+ l6 I7 L' d) H! l 不停的ping地方主机,直到你按下Control-C。 6 t, z, u% h2 |" X1 [
( i6 T; P+ u1 V0 _9 }4 c! K 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 X$ ?" _6 ~; o! N. w# e
1 z* @5 V& Z8 p" k% e -a Resolve addresses to hostnames.
6 h; G F. q0 k( ^
1 h8 p% U' u/ ?: f6 Z. I, I 解析计算机NetBios名。 ; T1 k0 M* K5 E! [$ ^1 E; j
2 P6 ~, R6 N! }% m
示例:C:\>ping -a 192.168.1.21
/ ~; l3 s' u0 m% ~. E* K: ~ Z
2 Q+ F* s( B# `% O$ y, a" p" Q+ B( P* u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
& u! A$ W9 M8 ^+ n$ K& C" K
7 n) j4 ?+ d- M/ Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ T, ~! |5 z/ N3 Y$ |
2 ^: d9 O' x3 Z8 g2 o7 Q# l- _. f Q K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 U* _" R$ z. K; b: Q: w2 d
1 j W4 a, X' v6 J% [% t4 g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 w3 K! c. l* ~/ z
1 g8 y5 _ J$ i' V8 j' R/ O6 c* v 1 B& V* `- L# ]8 J% j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! h) A$ B' H* u. W/ K0 q
/ y6 g- X. z* D; a! e$ G
Ping statistics for 192.168.1.21: 0 q: t4 ~! L) j% A& H5 G
# o- t. t2 d0 l/ W
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 }8 \9 U/ ] f) R+ _2 U
. \' {. c; z% j7 @7 w( i" S' m Minimum = 0ms, Maximum = 0ms, Average = 0ms
% Y- _9 E' G" P \3 k1 a
% d3 T8 X: b, q8 M/ D 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ ^6 |0 e3 [7 U% }7 M% I1 u: j# ` * V! K ?$ C: r
-n count Number of echo requests to send. * x" v! N4 C# |) ?( R/ m% |
. @2 R& x3 i2 {5 A( n: q
发送count指定的Echo数据包数。
4 d' L! _- p( s0 s" l7 R7 P W
+ P- [5 h! k# N# u; y6 y% i 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
D' I- f; A0 S4 E
$ W) {$ D8 v5 H C:\>ping -n 50 202.103.96.68
$ @, [; l. N& R7 a$ ]# p
, z9 ]$ G% x/ A4 H Pinging 202.103.96.68 with 32 bytes of data: / n! M. @& Z. ~9 b! w B
6 A$ ^8 _* \9 A% Y: e0 G, ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% e0 N, G* @# }2 c
! d( g, F0 h Q3 i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; U# }$ V2 y% o( \ e- s0 k1 F0 ~) W* P: T! l/ p S4 W! Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. u$ N5 N/ ?3 D8 Q $ b) |8 x7 `+ |4 l; s) s
Request timed out. ) v- D; E* u! j# f
) C, f& _: v5 I/ v7 E# v
………………
* t$ ]! g2 R3 C & c6 {' J7 P' r/ w4 ]/ o4 e: ?' M; }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 w* N! U7 \6 y T( j4 B7 R
- y6 l3 a# X8 s& f0 }' \- H+ F% t Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 G( x7 p! q, m8 M. |: Z. S) i( P, d; J
0 h6 M$ @5 K0 }0 e5 h8 \/ |( Q5 ^ Ping statistics for 202.103.96.68: 8 y0 n0 n/ P% _3 b: E
+ r) H# [; @6 ^4 a/ p& X, a
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 {, z% s$ A8 n" C% R9 p/ J
- t- ~$ F) F! O' M9 x2 V3 ~# h. S Minimum = 40ms, Maximum = 51ms, Average = 46ms 9 h) ^" d8 ~, m$ ] n7 G
' N- R; z* ]* N 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' a- F" j/ z1 W1 Z' y
$ o: A3 y4 F4 Y0 f
-l size Send buffer size. ; |6 U G8 j! t! E0 ^4 z- @
& N! d# x, Z3 Y/ Q
定义echo数据包大小。 |
|