找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6953|回复: 1

[脚本] 按在线数自动改队列限速脚本

[复制链接]
发表于 2012-1-5 00:59:21 | 显示全部楼层 |阅读模式

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

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

×

                               
登录/注册后可看大图


total upload=1M
total download =8M

script:

:global count1 11

:global count2 21

:global count3 31

:global count4 41

:global count5 51

:global up0 200000

:global up1 160000

:global up2 128000

:global up3 100000

:global up4 64000

:global down0 0

:global down1 4000000

:global down2 3000000

:global down3 2000000

:global down4 1000000

:global upname "pcq-all-up"

:global downname "pcq-web-down"

:global online [:len [/ip firewall address-list find list=list]]

:if ($online < $count1) do={

:if (([/queue type get [/queue type find name=$upname] pcq-rate]!=$up0) || ([/queue type get [/queue type find name=$downname] pcq-rate]!=$down0)) do={

/queue type set [/queue type find name=$upname] pcq-rate=$up0;/queue type set [/queue type find name=$downname] pcq-rate=$down0}}

:if ($online >= $count1 && $online < $count2) do={

:if (([/queue type get [/queue type find name=$upname] pcq-rate]!=$up1) || ([/queue type get [/queue type find name=$downname] pcq-rate]!=$down1)) do={

/queue type set [/queue type find name=$upname] pcq-rate=$up1;/queue type set [/queue type find name=$downname] pcq-rate=$down1}}

:if ($online >= $count2 && $online < $count3) do={

:if (([/queue type get [/queue type find name=$upname] pcq-rate]!=$up2) || ([/queue type get [/queue type find name=$downname] pcq-rate]!=$down2)) do={

/queue type set [/queue type find name=$upname] pcq-rate=$up2;/queue type set [/queue type find name=$downname] pcq-rate=$down2}}

:if ($online >= $count3 && $online < $count4) do={

:if (([/queue type get [/queue type find name=$upname] pcq-rate]!=$up3) || ([/queue type get [/queue type find name=$downname] pcq-rate]!=$down3)) do={

/queue type set [/queue type find name=$upname] pcq-rate=$up3;/queue type set [/queue type find name=$downname] pcq-rate=$down3}}

:if ($online >= $count5) do={

:if (([/queue type get [/queue type find name=$upname] pcq-rate]!=$up4) || ([/queue type get [/queue type find name=$downname] pcq-rate]!=$down4)) do={

/queue type set [/queue type find name=$upname] pcq-rate=$up4;/queue type set [/queue type find name=$downname] pcq-rate=$down4}}
routeros
发表于 2012-1-11 21:50:06 | 显示全部楼层
这个脚本好
:global online [:len [/ip firewall address-list find list=list]]
获取在线客户机数这里是不是应该有相应的规则
/ip firewall filter add chain=forward src-address=192.168.0.0/24
connection-state=established action=add-src-to-address-list address-list=list
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 09:23 , Processed in 0.060979 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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