转载未测试,谨慎使用 /ip fir fil add chain=forward src-address=192.168.0.0/24 action=add-src-to-address-list address-list=pcq_list address-list-timeout=5s comment="pcq_list_add" /que typ add name="pqc_http_down" kind=pcq pcq-rate=824000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=200000 add name="pcq_up" kind=pcq pcq-rate=284000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=20000 /que sim #取消对网关的限制# add name="admin" target-addresses=192.168.0.0/24 dst-address=192.168.0.0/24 interface=all parent=none direction=both priority=1 queue=default/default limit-at=0/0 max-limit=0/0 total-queue=default disabled=no #PCQ分配# add name="pcq" target-addresses=192.168.0.0/24 dst-address=0.0.0.0/0 interface=LAN parent=none direction=both priority=8 queue=pcq_up/pqc_http_down limit-at=0/0 max-limit=384000/1000000 burst-limit=384000/1000000 burst-threshold=64000/256000 burst-time=3s/3s total-queue=default-small disabled=no 脚本1秒1次 :global maxdown :global maxup :global mindown :global minup :global resDown :global resUp :global yz :global pcqup :global pcqdown :global pcqdownold :global pcqupold :global a :global testup :global testdown :global pcqitem :global curUp :global curDown :set maxdown 1024000 :set maxup 384000 :set mindown 120000 :set minup 80000 :set resDown 200000 :set resUp 100000 :set yz 100 :set pcqitem [:len [/ip firewall address-list find list=pcq_list> :if ($pcqitem!=0) do={ :set pcqdown [/queue type get [/queue type find name=pqc_http_down] pcq-rate] :set pcqdownold $pcqdown :set pcqup [/queue type get [/queue type find name=pcq_up] pcq-rate] :set pcqupold $pcqup :set curDown 1 :set curUp 1 /int mon PPPOE once do={:set curDown $"received-bits-per-second"} /int mon PPPOE once do={:set curUp $"sent-bits-per-second"} :set testdown ($maxdown+-$curDown+-$resDown) :if ($testdown>0) do={ :set pcqdown ($pcqdown+($testdown/$yz)) } :if ($testdown<=0) do={ :set pcqdown ($pcqdown+$testdown) } :set a ($maxdown+-$resDown) :if ($pcqdown>$a) do={:set pcqdown $a} :set a ($maxdown/$pcqitem) :if ($pcqdown<$a) do={:set pcqdown $a} :set testup ($maxup+-$curUp+-$resUp) :if ($testup>0) do={ :set pcqup ($pcqup+($testup/$yz)) } :if ($testup<=0) do={ :set pcqup ($pcqup+$testup) } :set a ($maxup+-$resUp) :if ($pcqup>$a) do={:set pcqup $a} :set a ($maxup/$pcqitem) :if ($pcqup<$a) do={:set pcqup $a} :if ($pcqdown!=$pcqdownold) do={ :if ($pcqdown>$mindown) do={ /queue type set [/queue type find name="pqc_http_down"] pcq-rate=$pcqdown } else={ /queue type set [/queue type find name="pqc_http_down"] pcq-rate=$mindown } } :if ($pcqup!=$pcqupold) do={ :if ($pcqup>$minup) do={ /queue type set [/queue type find name="pcq_up"] pcq-rate=$pcqup } else={ /queue type set [/queue type find name="pcq_up"] pcq-rate=$minup } } } |
|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )
GMT+8, 2024-11-5 21:39 , Processed in 0.034250 second(s), 5 queries , Gzip On, Redis On.
Powered by Discuz! X3.5 Licensed
© 2001-2024 Discuz! Team.