📄 自动限速.txt
字号:
:local User 0
:local Rx 0
:local Tx 0
:local RxM 50000
:local TxM 200000
:local RxCurAddress 0
:local RxCurUser 0
:local RxCurRate 0
:local TxCurRate 0
:local RxMaxRate 100000
:local TxMaxRate 1100000
:local a 0
:foreach b in=[/ppp secret find service=pppoe] do={:set User [/ppp secret get $b name];/queue simple remove $User};:if(!(nothing=[/interface find mtu=1480])) do={:foreach s in=[/interface find mtu=1480] do={/interface monitor $s once do={:set Rx ($received-bits-per-second); :set Tx ($sent-bits-per-second);:if(($Rx>$RxM) || ($Tx>TxM)) do{:set a ($a+1)}}}}; :if($a>2) do{:foreach i in=[/interface find mtu=1480] do={/interface monitor $i once do={:set RxCurRate ($received-bits-per-second); :set TxCurRate ($sent-bits-per-second); :set RxCurAddress [/ppp active get $i address]; :set RxCurUser [/ppp active get $i name]; :if($RxMaxRate<$RxCurRate) do={/queue simple add name=$RxCurUser dst-address=$RxCurAddress limit-at=0/0 max-limit=1200000/120000 priority=1}; :if($TxMaxRate<$TxCurRate) do={/queue simple add name=$RxCurUser dst-address=$RxCurAddress limit-at=0/0 max-limit=1200000/120000 priority=1}}}}
max-limit=1000000/120000是下行/上行
删除帐号pppoe
:foreach b in=[/ppp secret find service=pppoe] do={:set User [/ppp secret get $b name];/queue simple remove $User}
:local User 0
:local RxCurAddress 0
:local RxCurUser 0
:local RxCurRate 0
:local TxCurRate 0
:local RxMaxRate 120000
:local TxMaxRate 800000
:local a 0
:foreach b in=[/ppp secret find service=pppoe] do={:set User [/ppp secret get $b name];/queue simple remove $User};:if(!(nothing=[/interface find mtu=1480])) do={:foreach s in=[/interface find mtu=1480] do={:set a ($a+1)}}; :if($a>1) do{:foreach i in=[/interface find mtu=1480] do={/interface monitor $i once do={:set RxCurRate ($received-bits-per-second); :set TxCurRate ($sent-bits-per-second); :set RxCurAddress [/ppp active get $i address]; :set RxCurUser [/ppp active get $i name]; :if($RxMaxRate<$RxCurRate) do={/queue simple add name=$RxCurUser dst-address=$RxCurAddress limit-at=0/0 max-limit=1200000/120000}; :if($TxMaxRate<$TxCurRate) do={/queue simple add name=$RxCurUser dst-address=$RxCurAddress limit-at=0/0 max-limit=1200000/120000}}}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -