|
发表于 2008-3-30 04:40:21
|
显示全部楼层
另类ROS限速让限速更稳定更智能
作者:佚名 文章来源:网上搜集 点击数: 更新时间:2007-12-13 21:58:59
:for aaa from 1 to 254 do={/queue simple add name=(PC . $aaa) dst-address=(192.168.0. . $aaa) limit-at=500000/500000 max-limit=3000000/3000000}
/ ip firewall mangle
add chain=prerouting action=mark-packet new-packet-mark=all-mark passthrough=yes comment="" disabled=no
/ queue type
add name="PCQ-up" kind=pcq pcq-rate=1500000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000
add name="PCQ-down" kind=pcq pcq-rate=1500000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000
/ queue simple
add name="PCQ" target-addresses=192.168.0.0/24 dst-address=0.0.0.0/0 interface=all parent=none packet-marks=all-mark direction=both priority=1 queue=PCQ-up/PCQ-down limit-at=0/0 max-limit=15000000/15000000 total-queue=default-small disabled=yes
/ system script
add name="PCQON" source=":if \(\[ /queue sim get \[/queue sim find name=\"PCQ\"\] disable \]=true \) do={/queue sim enable PCQ}" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="PCQOFF" source=":if \(\[ /queue sim get \[/queue sim find name=\"PCQ\"\] disable \]=false \) do={/queue sim disable PCQ}" policy=ftp,reboot,read,write,policy,test,winbox,password
/ tool traffic-monitor
add name="PCQON" interface=WAN traffic=received trigger=above threshold=14800000 on-event=PCQON comment="" disabled=no
add name="PCQOFF" interface=WAN traffic=received trigger=below threshold=5000000 on-event=PCQOFF comment="" disabled=no
==================================================
上面是完整脚本,直接把每一段复制进去就可以了。需要修改的看下面的说明!
下面是注释
15M为例 静态是3M,达到14.8M后启用动态是1.5M!
:for aaa from 1 to 254 do={/queue simple add name=(PC . $aaa) dst-address=(192.168.0. . $aaa) limit-at=500000/500000 max-limit=3000000/3000000}
这个是建立静态限速,1to254 改为你内网的IP!比如 2 to 120! 192.168.0. 这里改为你的IP段! limit-at=500000/500000 是平均网速500K,max-limit=3000000/3000000 是普通限速3M!
注意一下,,在网盟里,包括很多高手都把ROS的算法搞错了,在这里我抖正一下,ROS不是1KB=8Kbit! 而是 1000=1K 1000000=1M
/ ip firewall mangle
add chain=prerouting action=mark-packet new-packet-mark=all-mark passthrough=yes comment="" disabled=no
这个是固定脚本!
/ queue type
add name="PCQ-up" kind=pcq pcq-rate=1500000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000
add name="PCQ-down" kind=pcq pcq-rate=1500000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000
这里把1500000改为你动态限速时的全网上传速度和下载速度!其他不要改!这里是1.5M!
/ queue simple
add name="PCQ" target-addresses=192.168.0.0/24 dst-address=0.0.0.0/0 interface=all parent=none packet-marks=all-mark direction=both priority=1 queue=PCQ-up/PCQ-down limit-at=0/0 max-limit=15000000/15000000 total-queue=default-small disabled=yes
到这里就是建立动态限速的策略了!192.168.0.0/24 改为你IP段!max-limit=15000000/15000000 这里是你总宽带,电信给你多少就填多少!其他不用改,,因为需要转跳到上面的!
/ system script
add name="PCQON" source=":if \(\[ /queue sim get \[/queue sim find name=\"PCQ\"\] disable \]=true \) do={/queue sim enable PCQ}" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="PCQOFF" source=":if \(\[ /queue sim get \[/queue sim find name=\"PCQ\"\] disable \]=false \) do={/queue sim disable PCQ}" policy=ftp,reboot,read,write,policy,test,winbox,password
这个是启发脚本,就是启发动态和关闭动态的脚本!直接复制!
/ tool traffic-monitor
add name="PCQON" interface=WAN traffic=received trigger=above threshold=14800000 on-event=PCQON comment="" disabled=no
add name="PCQOFF" interface=WAN traffic=received trigger=below threshold=5000000 on-event=PCQOFF comment="" disabled=no
这个是流量监控,我有15M设置是14.8M启发,足够了。不会延时或者怎么的,不建议改得太少。threshold=5000000是少于5M时关闭动态!这个自己掌握好!多试试!
另外注意的是!interface=WAN 把WAN改成你外网的网卡!
上面的每一段都需要,少一段这个脚本就不完整!不然没效果不要说我!
关于时间段来启发脚本我发出来了,,只需要改最后一段就OK了!受之网盟,反哺网盟!
======================================================
/system scheduler add name=timeon interval=24h start-time=08:00:00 on-event={PCQON} disabled=no
/system scheduler add name=timeoff interval=24h start-time=23:59:59 on-event={PCQOFF} disabled=no
==============================================================
把最后一段替换成这段就是由时间段控制开关PCQ了! |
|