风一样的男孩 发表于 2011-8-31 19:38:54

多ADSL负载–掉线后自动修改pcc/nth参数 保证网络畅通

很多朋友提出了这个问题,假如有4条ADSL跑PCC负载,掉了其中一条后网络就会出现问题,网页打不开或者很慢等等,这是由于PCC参数不匹配造成的。针对这样的情况WGHBOY兄已经发过一脚本,今天应一个朋友的需要测试后发现该脚本判断不太准确,呵呵。遂花了点时间重新编写达到所要目的。



以4线为例,其中某条线路断了后,会自动判断剩余可用的线路数量然后修改PCC规则的参数,线路恢复正常后会自动把参数修改回正常状态,注意连接标记名称一定要以纯数字“1、2、3、4…”来命名。一般该脚本设置30秒间隔就比较合适。

PCC:



{

:local status

:local i "5"

:local x "0"

:local y "0"

:local z "0"

:set x [:len ]

:if ($x<$i) do={

:for ii from=1 to=$i do={

:set status running]

:if ($status=true) do={

/ip fir man set per-connection-classifier=("both-addresses:".$x."/".$y) disable=no;:set y ($y+1)} else={

/ip fir man set disable=yes}}}

:if ($x=$i) do={

:set z [:len ]

:if ($z>0) do={

:for ii from=1 to=$i do={

/ip fi man set per-connection-classifier=("both-addresses:".$x."/".$y) disable=no;:set y ($y+1)}}}}



NTH:



{

:local status

:local i "5"

:local x "0"

:local y "1"

:local z "0"

:set x [:len ]

:if ($x<$i) do={

:for ii from=1 to=$i do={

:set status running]

:if ($status=true) do={

/ip fir man set nth=($x.",".$y) disable=no;:set y ($y+1)} else={

/ip fir man set disable=yes}}}

:if ($x=$i) do={

:set z [:len ]

:if ($z>0) do={

:for ii from=1 to=$i do={

/ip fi man set nth=($x.",".$y) disable=no;:set y ($y+1)}}}}
页: [1]
查看完整版本: 多ADSL负载–掉线后自动修改pcc/nth参数 保证网络畅通