ROS设置PPPOE根据客户数量自动调整限速
以下脚本请亲自测试效果:建立一个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 ]
#得到平均上传速率
: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 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中算术符号一定要有空格。
页:
[1]