ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 11059|回复: 6

[交流] ROS软路由器PCQ限速特殊策略 根据即时速度调速限速..

[复制链接]
发表于 2008-9-5 07:44:00 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

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

x
pcq限速
:for aaa from 1 to 254 do={/queue simple add max-limit=3000000/3000000 limit-at=300000/300000 dst-address=(192.168.0. . $aaa) name=(PC . $aaa) }


/ ip firewall mangle
add action=mark-packet chain=prerouting passthrough=yes new-packet-mark=all-mark disabled=no comment=""


/ queue type
add kind=pcq pcq-rate=1300000 name="pcq-up" pcq-limit=30 pcq-total-limit=2000 pcq-classifier=src-address
add kind=pcq pcq-rate=1300000 name="pcq-down" pcq-limit=30 pcq-total-limit=2000 pcq-classifier=dst-address


/ queue simple
add target-addresses=192.168.0.0/24 name="pcq" interface=all dst-address=0.0.0.0/0 packet-marks=all-mark parent=none priority=1 direction=both limit-at=0/0 disabled=yes queue=pcq-up/pcq-down total-queue=default-small max-limit=13000000/13000000


/ system script
add name="pcqon" source=":if ([ /queue simple get [/queue simple find name="pcq"] disable ]=true ) do={/queue simple enable pcq}" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="pcqoff"source=":if ([ /queue simple get [/queue simple find name="pcq"] disable ]=false ) do={/queue simple disable pcq}" policy=ftp,reboot,read,write,policy,test,winbox,password


/ tool traffic-monitor
add interface=wan name="pcqon" trigger=above traffic=received on-event=pcqon threshold=13800000 disabled=no comment=""
add interface=wan name="pcqoff" trigger=below traffic=received on-event=pcqoff threshold=3000000 disabled=no comment=""
==================================================
以上为全部脚本,每脚本复制即可用。按下面说明做相应修改。


以下是注释:
以3M限速为例,静态限速3M,到达2.8M即启用动态3M限速。


:for aaa from 1 to 254 do={/queue simple add dst-address=(192.168.0. . $aaa) name=(PC . $aaa) max-limit=3000000/3000000 limit-at=300000/300000}


这是静态限速的脚本,1到254 修改为相应的内网IP地址,比如2到120。 192.168.0.改为你的内网IP段。limit-at=300000/300000代表平均网速是300K位速率,max-limit=3000000/3000000代表普通限速3M位速率。


在论坛里,很多人搞错了ROS软路由的限速算法。注意,ROS软路由1000=1K 1000000=1M。


/ ip firewall mangle
add action=mark-packet chain=prerouting passthrough=yes new-packet-mark=all-mark disabled=no comment=""


/ queue type
add pcq-total-limit=2000 pcq-rate=1300000 name="pcq-up" pcq-classifier=src-address pcq-limit=30 kind=pcq
add kind=pcq name="pcq-down" pcq-limit=30 pcq-rate=1300000 pcq-total-limit=2000 pcq-classifier=dst-address


把1300000修改成你动态限速时的上传速度和下载速度,注意是全网网速。
/ queue simple
add disabled=yes target-addresses=192.168.0.0/24 name="pcq" interface=all dst-address=0.0.0.0/0 packet-marks=all-mark parent=none priority=1 direction=both limit-at=0/0 queue=pcq-up/pcq-down total-queue=default-small max-limit=13000000/13000000


这是动态限速策略的建立。192.168.0.0/24 修改成相应的IP地址段。max-limit=13000000/13000000修改为你总宽带,运营商卖给你多少速率就填写多少。
/ system script
add name="pcqon"source=":if ([ /queue simple get [/queue simple find name="pcq"] disable ]=true ) do={/queue simple enable pcq}" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="pcqoff"source=":if ([ /queue simple get [/queue simple find name="pcq"] disable ]=false ) do={/queue simple disable pcq}" policy=ftp,reboot,read,write,policy,test,winbox,password
以上是触发脚本,就是触发动态蔌关闭动态的脚本。
/ tool traffic-monitor
add interface=wan name="pcqon" trigger=above traffic=received on-event=pcqon threshold=13800000 disabled=no comment=""
add interface=wan name="pcqoff" trigger=below traffic=received on-event=pcqoff threshold=3000000 disabled=no comment=""
以上是网速监视,因为是13M所以设置是13.8M触发就可以了。threshold=3000000是小于3M时关闭动态,可做适当修改,根据需要调整。interface=wan 中的wan要修改为外网卡名称。
发表于 2014-4-4 08:54:13 | 显示全部楼层
学习  学习学习
发表于 2014-7-23 01:13:32 | 显示全部楼层
谢谢大神的分享与指导,小弟学习了
发表于 2014-8-4 20:45:22 | 显示全部楼层
好像很复杂呀,o(∩_∩)o
发表于 2014-10-5 11:57:35 | 显示全部楼层
限速老搞不懂
发表于 2015-5-4 15:04:56 | 显示全部楼层
谢大神的分享与指导,小弟学习了!!!!!!!!!!!!!!!!!!!!!!!
发表于 2015-7-8 20:48:04 | 显示全部楼层
大哥力挺你,这贴太好了,很好很好,特别是那注释
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-8-7 03:15 , Processed in 0.095434 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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