|
以下脚本请亲自测试效果:
建立一个profile- /ppp profile
- add name=”pt” local-address=172.16.0.1 remote-address=pppoe-pool1 \
- only-one=yes rate-limit=90k/1000k dns-server=172.16.0.1 \
- 建立PPPoE客户,建立的PPPoE客户要调用pt的profile
- 拔号后,就会在queues simple里动态生成限速表
- 自动调整的脚本如下:
- #客户数量
- :local count1 0
- #上传速率,这里是2条ADSL
- :local UpRate (2*500000)
- #下载速率
- :local DownRate (2*3000000)
- #平均上传速率
- :local UpAverage 90000
- #平均下载速率
- :local DownAverage 1000000
- #得到客户数量
- :set count1 [:len [/ppp act find]]
- #得到平均上传速率
- :set UpAverage ($UpRate/$count1)
- #得到平均下载速率
- :set DownAverage ($DownRate/$count1)
- #最低上传下载速率
- :if ($UpAverage < 90000) do={:set UpAverage 90000}
- :if ($DownAverage < 1000000) do={:set DownAverage 1000000}
- #得到限速值
- :local LimitAt (($UpAverage*70/100/1000*1000) . “/” . ($DownAverage*70/100/1000*1000))
- #得到最大限速
- :local MaxLimit ($UpAverage . “/” . $DownAverage)
- #突发极限
- :local BurstLimit (($UpAverage*185/100/1000*1000) . “/” . ($DownAverage*185/100/1000*1000))
- #突发的平均值
- :local BurstThr (($UpAverage*60/100/1000*1000) . “/” . ($DownAverage*60/100/1000*1000))
- #突发时间
- :local BurstTime “3s/3s”
- /que sim
- set [find dynamic=true] queue=default/default limit-at=$LimitAt max-limit=$MaxLimit burst-limit=$BurstLimit burst-threshold=$BurstThr burst-time=$BurstTime
复制代码
在2.9.27和3.13运行正常。在3.13中算术符号一定要有空格。 |
绿茶, 网吧, 3389, 服务器, 3389, 3389, 3389, ndeer, 极速版, 诺德尔, 3389, VGA, 服务器, 3389, 3389, 3389, DNF, 锐起, 3389, 网吧, 网吧系统, 3389, 服务器, 网吧, 网管, 网维大师, 3389, 系统封装,
|