收藏 分享(赏)

限速功能的原理及相应的配置文档.doc

上传人:jinchen 文档编号:7751164 上传时间:2019-05-25 格式:DOC 页数:13 大小:1.10MB
下载 相关 举报
限速功能的原理及相应的配置文档.doc_第1页
第1页 / 共13页
限速功能的原理及相应的配置文档.doc_第2页
第2页 / 共13页
限速功能的原理及相应的配置文档.doc_第3页
第3页 / 共13页
限速功能的原理及相应的配置文档.doc_第4页
第4页 / 共13页
限速功能的原理及相应的配置文档.doc_第5页
第5页 / 共13页
点击查看更多>>
资源描述

1、流量速率限制模块用户配置和使用手册本章包括如下内容: 概述 限速原理及实现 限速的相关配置 显示配置信息 使用举例第一章 概述目前,随着 Internet 的广泛应用,网络中的通信量越来越大,网络中传输的数据流很可能会汇聚到一个链路上从而导致网络的拥塞甚至瘫痪,使网络资源的利用率大大下降。同时网络运营商希望通过用户的不同级别来合理分配带宽,以达到根据使用者的付费来分配带宽的目的。此外网络中的安全性也是一个重要的问题。HammerOS 系列交换机的限速技术就是一种灵活分配带宽、有效防止非法攻击的一种网络资源调控技术。HammerOS 系列交换机就是通过和路由引擎相结合而具备有多种限速的功能,从而

2、达到了指定速率的效果。它可根据用户的不同等级分别给予用户不同的带宽。HammerOS 系列交换机可按 64Kbps 为单位进行速率限制,至 64Mbps。用户可根据需要,实现端口、VLAN、 SIP、 DIP、SMAC 、TOS、VPT 等多种限速方案,同时还可实现 QOS(IP 到 TOS映射、VPT 到 TOS 映射和 TOS 到 COS 映射等)系列标准,满足了不同级别的服务需求,具有很强的灵活性。从而提高了网络带宽利用率,使网络资源得到有效的控制,增强了网络性能。第二章 限速原理及实现原理HammerOS 系列交换机的限速功能主要是通过令牌桶算法实现的,令牌桶算法的基本思想是:任何数据

3、要进入网络,一定要先从令牌桶中获取一个令牌。如果此时令牌桶为空,则所到数据就要被丢弃。令牌桶的大小规定了可以发送流的数目,从而可以控制流量的突发速率。一个令牌桶过滤器可由三个参数完全描述:T 表示系统的时钟模式,即每个包可划分的 令牌数,HammerOS 交换机系统规定每个包划分为一个字节的令牌。L 表示令牌桶的最大深度,R 表示令牌连续注入令牌桶的速率。当长度为 P 的流通过时,将消耗桶内 P 个令牌。除非令牌桶内有足够的令牌,否则数据将不被发送。如果发送源在发送数据时,若令牌桶内始终有足够的令牌供其使用(不会因没有令牌而等待) ,则称发送源的流量符合令牌桶过滤器(R,L) 。考虑到 R 对

4、 L 的影响,对于给定的流量产生过程,HammerOS 系统定义了一个非递增的函数 L(R) ,使得该过程符合令牌桶(R,L(R) )。令牌桶过滤器允许发送源发送突发的数据,此时突发数据的总的比特数等于令牌桶内令牌的数量,显然,它小于令牌桶的最大深度 L。因此,符合令牌桶过滤器(R,L)的发送源其平均发送速率应小于或等于 R(bit/s) 。而且,在任意增加的时间 t 内,一个由令牌桶过滤器刻划其特征的发送源的流量都不会超过 R*t + L。根据上述特征,HammerOS 系列交换机成功的实现了限速功能。HammerOS 系列交换机流匹配实现HammerOS 系统中限速模块主要维护两张表结构:

5、Select table(流选择表)和 Flow table(流表) 。其匹配流的过程如下图:流程说明:流分类单元根据流类型从每个到达的包中选出 16 个字节(字节的选取是由 Select table决定的) ,利用 hash 算法算出一个 18 位的 hash 值。通过此 hash 值查找到相应流表进行匹配,每个流表都由 16 个字节的 pattern 值和 mask 值,如果包中每个字节按位与上相应字节的 mask 值,结果与其相应的 pattern 值相等,则为匹配流。如果不匹配,进入缺省的流表作相应处理。对于匹配流表的流,根据流表中的处理行为对匹配流作限速或其他操作。第三章 配置详解第

6、一节 限速相关配置在交换机上实现限速功能包含以下内容: 配置流量的特征绑定 配置流类型的缺省行为 配置绑定的客户接入文件 将用户接入配置文件和相应端口进行绑定,并且将这种流量绑定到流类型上,在端口上进行配置文件激活 删除配置操作或关闭限速功能操作配置流量的特征绑定,将流类型和相应属性进行绑定HammerOS 系列交换机支持四种流类型。在限速模块中只使用了三种流类型。对于每种流类型,通过查找至多 16 个字节来对所有流进行匹配。每种流类型可绑定的特征有源IP、目地 IP、源 MAC、VLAN、端口、VPT(Vlan Priority tag) 、TOS 等,并且支持这七种特征相互组合绑定(注:系

7、统不支持 vlan 和 port 组合绑定) 。要配制流的特征绑定,用以下命令:config flowtype bind port|vlan|smac|dip|sip|vpt|tos*7在配置流量和 SIP、DIP、SMAC 进行绑定时,可制定绑定的掩码,掩码的含义是流量可以通过 IP and MASK 或 SMAC and 源 MAC MASK 的方式进行区分。使用命令:config flowtype sipmask config flowtype dipmask config flowtype smacmask 例如:将流类型 1 绑定到 DIP 上,使用掩码 8 位。则键入命令:conf

8、lg flowtype 1 bind dipconfig flowtype 1 dipmask 8按回车,就执行此命令。配置流类型的缺省动作在 HammerOS 系统中,对于某种流类型不匹配的流缺省的行为是直接被转发的。但也可设置其缺省动作为 drop。利用命令:config flowtype default action continue|drop例如:配置流类型 1 的缺省动作为 drop,则键入命令:config flowtype 1 default action drop按回车,就执行此命令。配置绑定的客户接入文件,对每一个流量进行限制或其他操作,限速单位为 64Kbps。客户接入文件

9、中定义了用户所需要设置的一些流属性。如限制速率、COS 值、TOS 值、IP、SMAC 值等。可配置的参数包括: 所要限制的速率 SIP 地址及其子网掩码 DIP 地址及其子网掩码 源 MAC VPT 和 TOS 之间的映射关系 VLAN ID TOS COS(class of service)创建一个 customer-profile(客户接入文件)首先创建一个 customer-profile,名字为 name,name 最长为六个字符。利用命令:create customer-profile 例如:创建一个名字为 t11 的接入文件,则键入命令:create customer-profi

10、le t11按回车,就执行此命令。配置限制速率配置 customer-profile 的限制速率,范围为从 0 到 1000,0 为不需要限速,单位为64kbps。利用命令:config customer-profile input-bandwidth 例如:对接入文件 t11 限制速率为 32 * 64Kbps,则键入命令:config customer-profile t11 input-bandwidth 32按回车,就执行此命令。配置源 IP 地址及其掩码利用命令:config customer-profile sip 例如:对接入文件 t11 配置 sip 为 10.1.30.30/

11、8,则键入命令:config customer-profile t11 sip 10.1.30.30/8按回车,就执行此命令。配置目的 IP 地址及其掩码利用命令:config customer-profile dip 例如:对接入文件 t11 配置 dip 为 10.1.30.30/8,则键入命令:config customer-profile t11 dip 10.1.30.30/8按回车,就执行此命令。配置源 MAC 地址利用命令:config customer-profile smac 例如:对接入文件 t11 配置 smac 为 00015055ed45,则键入命令:config c

12、ustomer-profile t11 smac 00015055ed45按回车,就执行此命令。配置 COS 值COS(class of service)包括 2 位的优先级、1 位的丢弃优先权和 3 位的VPT,HammerOS 交换机可对这三个参数作配置,已达到不同需求。利用命令:config customer-profile priority discardability vpt 例如:配置接入文件 t11 的 COS 值为 priority 为 1,discardability 为 0,vpt 为 1,则键入命令:config customer-profile t11 priority

13、 1 discardability 0 vpt 1按回车,就执行此命令。配置 TOS 值对每个匹配的流,HammerOS 系统可以对其 IP 头中的 TOS 进行自设置。允许用户来配置其值,要求此值范围在 0-63 之间,同时此命令还可以设置绑定的 tos 值。利用命令:config customer-profile tos 例如:配置接入文件 t11 的 TOS 值为 1,则键入命令:config customer-porfile t11 tos 1按回车,就执行此命令。配置从 VPT 到 TOS 的映射关系利用命令:config customer-profile vpt tos 例如:配置

14、接入文件 t11 中 vpt 为 1,tos 为 2,则键入命令:config customer-profile t11 vpt 1 tos 2按回车,就执行此命令。配置 VLAN ID利用命令:config customer-profile vid 例如:配置接入文件 t11 中 vid 为 11,则键入命令:config customer-profile t11 vid 11按回车,就执行此命令。将用户接入配置文件和相应端口进行绑定,并且将这种流量绑定到流类型上,在端口上进行配置文件激活当用户接入配置文件建成之后,需要和相应的端口绑定,才能使这个配置文件有效。使能这个配置文件使用以下命令,

15、同时需要遵循一定规则。绑定端口和接入文件将相应端口和用户接入文件绑定,利用命令:config port |all bind customer-profile 此命令允许一次绑定多个配置文件在端口列表上。例如:要将配置文件 t11 与端口 8 绑定,则键入命令:config port 8 bind customer-profile t11按回车,就执行此命令。绑定端口和流类型在绑定配置文件和端口后,还需将流类型绑定到相应端口上。利用命令:config port |all service customer-profile flow-type 例如:将流类型 1 绑定到端口 8 上,此端口上已绑定了

16、配置文件 t11,则键入命令:config port 8 service customer-profile t11 flow-type 1按回车,就执行此命令。使能流计数在绑定配置文件到相应端口后,允许将流计数功能打开(或关闭) 。利用命令:config port |all service customer-profile counter enable|disable例如:使能端口 8 上绑定的配置文件 t11 的流计数,则键入命令:config port 8 service customer-profile t11 counter enable按回车,就执行此命令。如果输入 disable,

17、则表示关闭流计数功能。一般情况下最好关闭流计数功能,因为使能此项功能可能会导致每秒收到的包总量降低。激活配置文件当完成以上配置后,需要在端口上激活此配置文件,才能使配置有效。利用命令:config port |all service customer-profile status active|inactive例如:在端口 8 上激活配置文件 t11,则键入命令:config port 8 service customer-profile t11 status active按回车,就执行此命令。如果键入 inactive,则表示使此配置无效。如果更改配置文件中任意一项内容,要使此更改内容有效,

18、一定要先inactive 此配置,再 active 才能使之生效。配置匹配流的缺省行为在 HammerOS 系统中,对于在端口上绑定的匹配流的缺省动作是直接转发的。但我们可以设置这种缺省行为,利用命令;config port |all service customer-profile action continue|drop例如:要配置在端口 8 上匹配配置文件 t11 属性的流的缺省动作为 drop。则键入命令:config port 8 service customer-profile t11 action drop按回车,就执行此命令。如果已经激活了这个配置文件,又改变了其缺省行为,要使

19、此缺省行为有效,一定要先 inactive 此配置,再 active 才能生效。删除配置操作在做删除操作时,需遵循一定规则。使配置文件绑定无效要使端口上绑定的配置文件无效。利用命令:config port |all unbind customer-profile 例如:使端口 8 绑定的配置文件 t11 无效。则键入命令:config port 8 unbind customer-profile t11按回车,就执行此命令。在作此操作时,一定要先 inactive 此配置文件在端口上,才能执行此命令。删除配置文件利用命令:delete customer-profile 例如:要删除配置文件 t

20、11,则键入命令:delete customer-profile t11按回车,就执行此命令。在作此操作时,如果此配置文件已经在端口上激活,不允许删除此配置文件。使流的特征绑定无效要使流类型上绑定的属性无效,利用命令:config flowtype unbind例如:要是流类型 1 的特征绑定无效。则键入命令:config flowtype 1 unbind按回车,就执行此命令。第二节 显示状态信息显示配置文件信息用以下命令可以显示配置文件的状态:show customer-profile *1name 可键入也可不键入。当不输入 name 值时,显示当前所有配置文件的状态信息。如键入某个 c

21、ustomer-profile 的名字,则仅显示当前配置文件的状态信息。show 命令所显示的配置文件信息包括以下内容: 配置文件 name 输入带宽 源 IP 及其掩码 目的 IP 及其掩码 源 MAC 值 VPT TOS示例:显示配置文件 t11 的配置信息:HammerOS(config)# show customer-profile t11NAME INPUT-BW SIP DIP SMAC VPT TOSt11 32 10.0.0.0/8 0.0.0.0/0 00:00:00:00:00:00 0 23显示流表信息要显示流表信息,利用命令:show flow table示例:显示流表

22、信息:HammerOS(config)# show flow table-Device: 3-FlowTableIndex: 2168skip:0 st:0 aging:0 cmd:0 prio:0 discard:0 vlanPrioTag:0FlowType:0 modifyTarget:0 modifyToS:0 newToS:0 newTrgPort:0 newTrgDevice:0P(1-4):0x0a000000 P(5-8):0x00000000 P(9-12):0x00000000 P(13-16):0x00000000M(1-4):0xff000000 M(5-8):0x00

23、000000 M(9-12):0x00000000 M(13-16):0x00000000userDefined:0 packetCnt:675590597 reserved:0 flowcnt:1 octetsCnt:1880730216 I:1041 tet:0 L:4000000 enLB:1 lbMark:0 tickMode:1显示流选择表信息要显示流选择表信息,利用命令:show flow select示例略。第三节 限速配置举例下例是在 HammerOS 交换机中,有三种需求:1、 在 24 端口上对 dip 为 10.1.30.250/32 主机的下行流量进行限制,限制的带宽为

24、2Mbps。2、 在 5 端口对 smac 为 00102e3c67ed 的上行流量进行限制,限制带宽是 1Mbps。3、 在 14 端口上对 sip 为 10.1.30.250 的主机设置 NEWTOS 值为 23,实现 sip 到 tos 的映射。要完成上述设置,键入命令:将 smac 绑定到流类型 1 上,dip 绑定到流类型 2 上,并且设置 dipmask 为 32。sip 绑定到流类型 3 上,设置 sipmask 为 32:config flowtype 1 bind smacconfig flowtype 2bind dipconfig flowtype 2 dipmask 3

25、2config flowtype 3 bind sipconfig flowtype 3 sipmask 32配置流属性接入文件,键入命令:create customer-profile t11config customer-profile input-bandwidth 32config customer-profile dip 10.1.30.250/32create customer-profile t12config customer-profile input-bandwidth 16config customer-profile smac 00102e3c67edcreate cu

26、stomer-profile t13config customer-profile sip 10.1.30.250/32config customer-profile tos 23激活 customer-profile t11 在端口 24 上、t12 在端口 5、t13 绑定在端口 14 上,键入命令:config port 5 bind customer-profile t12config port 5 service customer-profile t12 flow-type 1config port 5 service customer-profile t12 couter enab

27、leconfig port 5 service customer-profile t12 status activeconfig port 14 bind customer-profile t13config port 14 service customer-profile t13 flow-type 3config port 14 service customer-profile t13 counter enableconfig port 14 service customer-profile t13 status activeconfig port 24 bind customer-pro

28、file t11config port 24 service customer-profile t11 flow-type 2config port 24 service customer-profile t11 counter enableconfig port 24 service customer-profile t11 status active组网如下图所示:第四节 命令列表下表列出了限速功能中使用的所有配置命令。HammerOS 中限速的配置命令表:命令 解释config flowtype bind port|vlan|smac|dip|sip|vpt|tos*7对流量进行特征绑定

29、,可绑定的属性为 port、vlan、 smac、dip、sip 、vpt的任意组合,但注意 520 模块不允许port 和 vlan 一起绑定。config flowtype dipmask 配置绑定 dip 的流类型的 dip 掩码值。范围为 1 到 32 中任意整数值。config flowtype sipmask 配置绑定 sip 的流类型的 sip 掩码值。范围为 1 到 32 中任意整数值。config flowtype smacmask 配置绑定 smac 的流类型的 smac 掩码值。config flowtype default action continue|drop配置流

30、类型的缺省动作。create customer-profile 创建一个 customer-profile,名字为name,要求最长不超过 6 个字符。config customer-profile input-bandwidth 配置一个名字为 name 的 customer-profile 的限制带宽,范围为 0 到1000,0 为不限速,单位是64Kbps。config customer-profile dip 配置 customer-profile 的 dip 值及掩码。掩码范围为 1 到 32。config customer-profile sip 配置 customer-profi

31、le 的 sip 值及掩码。掩码范围为 1 到 32。config customer-profile smac 配置 customer-profile 的 smac 值。config customer-profile vid 配置 customer-profile 的 VLAN ID值。范围为 1-4095。config customer-profile vpt tos 配置 customer-profile 的 VPT 到TOS 的映射。config customer-profile tos 配置 customer-profile 的 tos 值。config customer-profil

32、e priority discardability vpt 配置 customer-profile 的 cos 值。Cos分为三部分:priority、discardability和 vpt。config port |all bind customer-profile 绑定 customer-profile 到相应端口。允许绑定多个配置文件到多个端口。config port |all service customer-profile action continue|drop配置匹配配置文件的流的缺省行为。Continue 为转发,drop 为丢弃,缺省为 continue。config por

33、t |all service customer-profile flow-type 绑定端口和流类型。config port |all service customer-profile counter enable|disable使能或关闭流计数。输入 enable 表示使能流计数,disable 表示关闭流计数。config port |all service customer-profile status active|inactive在端口上激活此配置文件。config flowtype unbind 将流类型与相应的特征绑定去掉。config port |all unbind customer-profile 将端口与配置文件绑定去掉。delete customer-profile 显出一个 customer-profile。show customer-profile *1 显示 customer-profile 信息。show flow table 显示流表信息。show flow select 显示流选择表信息。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报