找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4669|回复: 4

[策略设置] 求助...怎么做ADSL双线负载怎么做小包优先跟Ros 按需分配带宽...

[复制链接]
发表于 2010-5-19 16:39:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 xiong239 于 2010-5-19 16:42 编辑

小弟前些天有大侠帮做了个rosADSL双线负载,在网上看到有小包优先跟ROS 按需分配带宽...
也下载来看了,但不知道如何在双线负载情况下使用..

发上小包优先文档跟小包优先跟Ros 按需分配带宽文档..希望高手帮忙指点一下..谢谢..小弟QQ:841288100
下面是小包优先文档:
/ ip firewall mangle
add chain=forward p2p=all-p2p action=mark-connection     new-connection-mark=p2p_conn passthrough=yes comment="" disabled=no
add chain=forward connection-mark=p2p_conn action=mark-packet     new-packet-mark=p2p passthrough=yes comment="" disabled=no
add chain=forward connection-mark=!p2p_conn action=mark-packet     new-packet-mark=general passthrough=yes comment="" disabled=no
add chain=forward packet-size=32-512 action=mark-packet new-packet-mark=small     passthrough=yes comment="" disabled=no
add chain=forward packet-size=512-1200 action=mark-packet new-packet-mark=big     passthrough=yes comment="" disabled=no

/ queue tree
add name="p2p1" parent=TEL packet-mark=p2p limit-at=2000000 queue=default     priority=8 max-limit=6000000 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="p2p2" parent=lan packet-mark=p2p limit-at=2000000 queue=default     priority=8 max-limit=6000000 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="ClassA" parent=LAN packet-mark="" limit-at=0 queue=default priority=8     max-limit=100000000 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="ClassB" parent=ClassA packet-mark="" limit-at=0 queue=default     priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="Leaf1" parent=ClassA packet-mark=general limit-at=0 queue=default     priority=7 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="Leaf2" parent=ClassB packet-mark=small limit-at=0 queue=default     priority=5 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no
add name="Leaf3" parent=ClassB packet-mark=big limit-at=0 queue=default     priority=6 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s     disabled=no

1-8级优先级控制,数字越小优先级越高

lan内网接口
TEL 外网接口
SMALL 小包 32-512字节  5级优先级
BIG 大包  512-1200字节   6级优先级
general 其它包 1200-1500字节  7级优先级
P2P类   8级优先,全局限速 600KB/S下载

或使用下面方法:
一:

/ ip firewall mangle
add chain=prerouting p2p=all-p2p action=mark-connection \
    new-connection-mark=p2p_conn passthrough=no comment="all-p2p" disabled=no
add chain=prerouting connection-mark=p2p_conn action=mark-packet \
    new-packet-mark=p2p passthrough=no comment="P2p-Packet" disabled=no
add chain=forward connection-mark=!p2p_conn action=mark-packet \
    new-packet-mark=general passthrough=yes comment="其他包" disabled=no
add chain=forward packet-size=32-512 action=mark-packet new-packet-mark=small \
    passthrough=yes comment="小包" disabled=no
add chain=forward packet-size=513-1200 action=mark-packet new-packet-mark=big \
    passthrough=yes comment="大包" disabled=no
/ ip firewall connection tracking
set enabled=yes tcp-syn-sent-timeout=2m tcp-syn-received-timeout=1m \
    tcp-established-timeout=1d tcp-fin-wait-timeout=2m \
    tcp-close-wait-timeout=1m tcp-last-ack-timeout=30s \
    tcp-time-wait-timeout=2m tcp-close-timeout=10s udp-timeout=30s \
    udp-stream-timeout=3m icmp-timeout=30s generic-timeout=10m


二:需要更改wan=外网网卡 lan=内网网卡

/ queue tree
add name="p2p1" parent=wan packet-mark=p2p limit-at=2000000 queue=default \
    priority=8 max-limit=4000000 burst-limit=0 burst-threshold=0 burst-time=0s \
    disabled=no
add name="p2p2" parent=wan packet-mark=p2p limit-at=2000000 queue=default \
    priority=8 max-limit=4000000 burst-limit=0 burst-threshold=0 burst-time=0s \
    disabled=no
add name="ClassA" parent=lan packet-mark="" limit-at=0 queue=default \
    priority=8 max-limit=100000000 burst-limit=0 burst-threshold=0 \
    burst-time=0s disabled=no
add name="ClassB" parent=ClassA packet-mark="" limit-at=0 queue=default \
    priority=7 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s \
    disabled=no
add name="Leaf1" parent=ClassA packet-mark=general limit-at=0 queue=default \
    priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s \
    disabled=no
add name="Leaf2" parent=ClassB packet-mark=small limit-at=0 queue=default \
    priority=5 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s \
    disabled=no
add name="Leaf3" parent=ClassB packet-mark=big limit-at=0 queue=default \
    priority=5 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s


下面是Ros 按需分配带宽:

Ros 按需分配带宽脚本,智能PCQ脚本.
Ros 按需分配带宽脚本,智能PCQ脚本.
红色的数字按自己实际带宽和地址修改
程序代码
#得到用户数量
/ip fir fil
add chain=forward src-address=192.168.0.0/24 action=add-src-to-address-list \
     address-list=pcq_list address-list-timeout=5s comment="pcq_list_add" \

#//***********************************Queue Type
/que typ
add name="pqc_http_down" kind=pcq pcq-rate=824000 pcq-limit=50 \
     pcq-classifier=dst-address pcq-total-limit=200000
add name="pcq_up" kind=pcq pcq-rate=284000 pcq-limit=50 \
     pcq-classifier=src-address pcq-total-limit=20000

#//***************************************in Simple Quueu
/que sim
#取消对网关的限制#
add name="admin" target-addresses=192.168.0.0/24 dst-address=192.168.0.0/24 \
     interface=all parent=none direction=both priority=1 queue=default/default \
     limit-at=0/0 max-limit=0/0 total-queue=default disabled=no
#PCQ分配#
add name="pcq" target-addresses=192.168.0.0/24 dst-address=0.0.0.0/0 \
    interface=LAN parent=none direction=both priority=8 \ #LAN名称,我的是LAN
     queue=pcq_up/pqc_http_down limit-at=0/0 max-limit=384000/1000000 \
    burst-limit=384000/1000000 burst-threshold=64000/256000 burst-time=3s/3s \
     total-queue=default-small disabled=no

#//******************************脚本,每2秒run1次
:set maxdown 1024000
:set maxup 384000
#最小带宽
:set mindown 120000
:set minup 80000
#保留带宽
:set resDown 200000
:set resUp 100000
#因子,根据带宽定
:set yz 500
:set pcqitem [:len [/ip firewall address-list find list=pcq_list]]
:if ($pcqitem!=0) do={
:set pcqdown [/queue type get [/queue type find name=pqc_http_down] pcq-rate]
:set pcqdownold $pcqdown
:set pcqup [/queue type get [/queue type find name=pcq_up] pcq-rate]
:set pcqupold $pcqup
#:set pcqdown ($maxdown/$pcqitem)
#:set pcqup ($maxup/$pcqitem)
:set curDown 1
:set curUp 1
/int mon PPPOE once do={:set curDown $received-bits-per-second}   #WAN 名称,我的是PPPOE
/int mon PPPOE once do={:set curUp $sent-bits-per-second}
:set testdown ($maxdown+-$curDown+-$resDown)
:if ($testdown>0) do={
:set pcqdown ($pcqdown+($testdown/$yz))
}
:if ($testdown<=0) do={
:set pcqdown ($pcqdown+$testdown)
}
:set a ($maxdown+-$resDown)
:if ($pcqdown>$a) do={:set pcqdown $a}
:set a ($maxdown/$pcqitem)
:if ($pcqdown<$a) do={:set pcqdown $a}
:set testup ($maxup+-$curUp+-$resUp)
:if ($testup>0) do={
:set pcqup ($pcqup+($testup/$yz))
}
:if ($testup<=0) do={
:set pcqup ($pcqup+$testup)
}
:set a ($maxup+-$resUp)
:if ($pcqup>$a) do={:set pcqup $a}
:set a ($maxup/$pcqitem)
:if ($pcqup<$a) do={:set pcqup $a}
:if ($pcqdown!=$pcqdownold) do={
:if ($pcqdown>$mindown) do={/queue type set [/queue type find name=pqc_http_down] pcq-rate=$pcqdown;} else={/queue type set [/queue type find

name=pqc_http_down] pcq-rate=$mindown;}
}
:if ($pcqup!=$pcqupold) do={
:if ($pcqup>$minup) do={/queue type set [/queue type find name=pcq_up] pcq-rate=$pcqup;} else={/queue type set [/queue type find name=pcq_up]

pcq-rate=$minup;}
}
}

#////
#优点:可以最大化网络
#缺点:不是程序级别,反应比较慢,通常由1-2秒的延时




各位大侠请指点下新手,谢谢...
routeros
 楼主| 发表于 2010-5-19 16:43:08 | 显示全部楼层
自己也顶一下..
routeros
回复

使用道具 举报

 楼主| 发表于 2010-5-19 17:13:11 | 显示全部楼层
看来只能自己顶了。。对了小弟的RouterOS是2.9.6的。。
routeros
回复

使用道具 举报

 楼主| 发表于 2010-5-22 10:11:20 | 显示全部楼层
三天过去了。。。贴也沉了。。
routeros
回复

使用道具 举报

发表于 2010-5-22 10:17:04 | 显示全部楼层
用3.13吧。。。。不用优先也行的
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-11-6 14:30 , Processed in 0.048401 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表