|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 p/ c% I `' {% v$ Q* z& b
' O/ r) ]+ C$ I4 n# Q0 t 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, R9 ?* Z* D0 V
1 A+ T1 n# Z: e6 b4 i9 q 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 2 L& @) M$ e) C" S9 Q- p
6 y( ?( t' e, y4 `% L Options: 8 ?/ I; D: y7 l) M) L8 w# i
8 l" ^8 `, U5 e, b& r7 H -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 8 U) W9 ?8 V" J# \0 J
' ]% L3 q4 }- _% u l
不停的ping地方主机,直到你按下Control-C。
- W# F' S. V, h5 X2 ^ 6 O5 Q0 |) H& n: D* G. J
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 L# M( h& r+ N 8 @) O$ a. o- g" G
-a Resolve addresses to hostnames. ( ?0 x3 i3 o- K: c3 X$ U2 C( E
4 z! ^2 C: s8 D1 g( m
解析计算机NetBios名。 0 r2 O- w6 e& _: }- d& G
% ?2 Y! U8 t0 G 示例:C:\>ping -a 192.168.1.21 " X! F" N+ E$ P; e9 c
( i+ h# `0 z1 v: h& \, q7 Y Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: & e/ {( z0 `; |; f. [
2 ]: L& Y O% Z) t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
c0 x4 E! y. C2 c7 @
' J- U) W# Q, F1 n8 j- a+ u" \! P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 _1 E q9 l6 c& X s
. s4 [3 }9 z* h h t% X Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ d6 W n2 {7 E7 U' t0 ]! c: T: b
G; P% f1 E! X2 ~7 q
# @. S7 i' _% l% T3 e7 ^% T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 X" ?1 e# T, b9 Z4 E1 x
6 A0 J0 @( q1 f9 J5 l
Ping statistics for 192.168.1.21:
7 f' `5 Z& z, E* {8 V ( z+ F7 G# _/ u' ]8 A! G6 o" u
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
- |% {: Z* v( ?4 ~7 w+ n4 v
* X& S$ y1 U2 z1 [3 [. R, c Minimum = 0ms, Maximum = 0ms, Average = 0ms " q) [* H$ d% v, Z
2 e# }" W% s/ f( t 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
% t3 {) i g5 f. z" O% X ; _5 d* W* q& a
-n count Number of echo requests to send. % ^7 @& P& M2 ~( g! A$ _8 j# x ~
- ?6 J* B" {, C6 u o7 t( a
发送count指定的Echo数据包数。
, t: V# J# O' W# l
5 b W2 ?' ~. t" K1 V' d# w 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - n% `; _' a/ s9 j
. D+ C3 K4 y. Y4 s0 \ C:\>ping -n 50 202.103.96.68 + e8 b# e* ^' ~0 b) t* b; I
0 u% O6 S5 T: f) Z( O9 h
Pinging 202.103.96.68 with 32 bytes of data:
" ]; a, I) |& P
- a6 t; v7 q7 a4 d% w9 Z! q# u Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 x! x2 t _8 C# {- t: O , T/ U3 a' F3 f6 Q5 b+ ?- v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " n0 ?6 D* |& f Y7 |5 v
/ o2 S" b7 ?5 O9 M* z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : |, ?1 i1 j- x5 w. E: F
8 P7 F X) x+ a- _; b! y Request timed out.
. v# | N5 K% t4 K5 \# i & m) N! {2 U7 |7 k& m1 I
……………… 3 s2 l$ W1 N! q
" ~$ d ^/ l( w( Z1 x8 k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # _9 {: L+ I4 z9 g! h4 K
s- l! w) ^ n0 e( g& S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! l1 A2 h2 v% J: B6 w( [
8 i( ]$ B% N% z
Ping statistics for 202.103.96.68:
9 z- l3 V- p7 {! x/ { 4 X" ]+ |/ |+ ]5 `( ?6 d
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 9 ]+ m9 j7 \4 z# e
: @' ~9 w$ j: E* i
Minimum = 40ms, Maximum = 51ms, Average = 46ms
: M( S8 |* @- j7 \& l( u 9 R* m2 M7 X! f# E; n
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 3 k. M9 {% p8 G
! z) D- y0 Q$ m- D1 |5 G
-l size Send buffer size.
. g, i1 X" n7 {6 o3 [0 K+ y7 K, E 8 J: @6 u! f! S" }+ n% ?
定义echo数据包大小。 |
|