|
马上注册成为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要修改为外网卡名称。 |
|