|
马上注册成为ROSABC会员,随时发帖回复。
您需要 登录 才可以下载或查看,没有账号?会员注册
x
Queue tree 队列树
操作路径: /queue tree
当你想使用基于协议,端口,IP 地址等的复杂数据分配流量时,你需要使用队列树。首先通过在/ip firewall mangle 下标记数据包流然后使用这个标记作为在这个队列树的数据包流标识。
属性描述
burst-limit (整数) - 当脉冲串激活时可以达到的最大数据率
burst-threshold (整数) - 用于计算是否允许脉冲。如果上一次脉冲时间的平均数据率低于 burst-threshold 则实际数 据率可能达到 burst-limit。
burst-time (整数) - 用于计算平均数据率。
flow (文本) - 在/ip firewall mangle 下标记的数据包流。 当前队列参数仅应用于用这个数据流标记标识了的数据包。
limit-at (整数) - 这个队列的约定流量
max-limit (整数) - 在有足够带宽可用的情况下可达到的流量
name (文本) - 队列的描述性名称
parent (文本) - 父队列的名称。顶级的父队列是可用的接口(实际上是主 HTB)。低级点的父队列可能是其他的队列。
priority (整数: 1..8) - 队列的优先级。 1 是最高级等级, 8 为最低。
queue (文本) - 队列类型名称。类型是在/queue type 下定义的。这个参数仅应用于树等级制中的子队列。
Queue tree HTB 实例
这个事例中,设定 3 类数据 VIP、Web 和 Other,这三类数据中 VIP 为网络内的重要用户优先级最高为 1,访问网页的数 据 web 其次为 2,而剩下的数据 Other 级别最低为 7,假设我们的网络是 1M 的 ADSL,我们通过配置 HTB 策略来保证网 络内的优先数据。
通过用 new-connection-mark 标记向外的连接,并采取 mark-connection 动作。当这个完成时你可以使用new-packet-mark 标记属于这个连接的所有数据包并采用 mark-packet。
首先 VIP 数据标记,我们通过 ip firewall address-list 定义 VIP 用户的地址列表,定义完成后通过 src-address-list 调用:
[admin@Office] /ip firewall mangle> print
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; vip
chain=forward action=mark-connection new-connection-mark=vip passthrough=yes src-address-list=vip
1 chain=forward action=mark-packet new-packet-mark=vip passthrough=no connection-mark=vip
跟着定义 web 数据,这里我们需要针对访问网页的 tcp/80 端口和域名解析的 DNS 端口 tcp/53 和 udp/53 端 口标记:
2 ;;; web
chain=forward action=mark-connection new-connection-mark=web passthrough=yes protocol=tcp dst-port=80
3 chain=forward action=mark-connection new-connection-mark=web passthrough=yes protocol=tcp dst-port=53
4 chain=forward action=mark-connection new-connection-mark=web passthrough=yes protocol=udp dst-port=53
5 chain=forward action=mark-packet new-packet-mark=web passthrough=no connection-mark=web
最后对剩下的 Other 数据进行标记,因为前面已经标记了 VIP 和 Web 的数据包,所有剩下数据就是其他的Other 数据:
6 ;;; other
chain=forward action=mark-connection new-connection-mark=other passthrough=yes
7 chain=forward action=mark-packet new-packet-mark=other passthrough=no connection-mark=other
标记数据完成后,我们进入 queue tree 中,对数据进行优先级的配置,ADSL 总带宽为 1Mbps 下行,250kps的上行,给三类数据带宽分配如下
-- VIP:下行 Max-limit=800k limit-at=400k,上行 Max-limit=2200k limit-at=200k,优先级 1
-- Web:Max-limit=800k limit-at=400k,上行 Max-limit=200k limit-at=200k,优先级 2
-- Other:Max-limit=600k limit-at=200k,上行 Max-limit=150k limit-at=50k,优先级 7
根据以上参数,我们在 queue tree 中配置队列优先级:
[admin@Office] /queue tree> print
Flags: X - disabled, I - invalid
0 name="totalup" parent=ADSL packet-mark="" limit-at=0 queue=default priority=1 max-limit=250000 burst-limit=0 burst-threshold=0 burst-time=0s
1 name="totaldown" parent=ether2 packet-mark="" limit-at=0 queue=default priority=8 max-limit=1000000 burst-limit=0 burst-threshold=0
burst-time=0s
2 name="vipdown" parent=totaldown packet-mark=vip limit-at=0 queue=default priority=2 max-limit=700000 burst-limit=0 burst-threshold=0 burst-time=0s
3 name="vipup" parent=totalup packet-mark=vip limit-at=0 queue=default priority=2 max-limit=150000 burst-limit=0 burst-threshold=0 burst-time=0s
4 name="otherdown" parent=totaldown packet-mark=other limit-at=0 queue=down priority=8 max-limit=500000 burst-limit=0 burst-threshold=0 burst-time=0s
5 name="otherup" parent=totalup packet-mark=other limit-at=0 queue=up priority=8 max-limit=150000 burst-limit=0 burst-threshold=0 burst-time=0s
6 name="webup" parent=totalup packet-mark=web limit-at=0 queue=default priority=1 max-limit=150000 burst-limit=0 burst-threshold=0 burst-time=0s
7 name="webdown" parent=totaldown packet-mark=web limit-at=0 queue=default priority=1 max-limit=700000 burst-limit=0 burst-threshold=0 burst-time=0s
|
|