注册 登录
自由的生活_软路由 返回首页

jacksonzhang的个人空间 https://bbs.routerclub.com/?121577 [收藏] [复制] [分享] [RSS]

日志

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

已有 1363 次阅读2011-4-20 00:58 |个人分类:ros资料|

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

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

 
 
 
1.jpg
2011-2-24 02:32 上传
下载附件 (124.36 KB)

 
 
 
 
 

 
2.jpg
2011-2-24 02:32 上传
下载附件 (124.56 KB)

 
 
 
 
 
 

3.jpg
2011-2-24 02:32 上传
下载附件 (120.75 KB)

 
 
 
 
 

 
4.jpg
2011-2-24 02:32 上传
下载附件 (119.62 KB)

 
 
 
 
 
 

5.jpg
2011-2-24 02:32 上传
下载附件 (116.36 KB)



PCC:

{
:local status
:local i "5"
:local x "0"
:local y "0"
:local z "0"
:set x [:len [/interface pppoe-client find running=yes]]
:if ($x<$i) do={
:for ii from=1 to=$i do={
:set status [/interface get [find name=("pppoe-out".$ii)] running]
:if ($status=true) do={
/ip fir man set [find new-connection-mark=$ii] per-connection-classifier=("both-addresses:".$x."/".$y) disable=no;:set y ($y+1)} else={
/ip fir man set [find new-connection-mark=$ii] disable=yes}}}
:if ($x=$i) do={
:set z [:len [/ip fir man find action="mark-connection" disabled=yes chain=prerouting]]
:if ($z>0) do={
:for ii from=1 to=$i do={
/ip fi man set [find new-connection-mark=$ii] 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 [/interface pppoe-client find running=yes]]
:if ($x<$i) do={
:for ii from=1 to=$i do={
:set status [/interface get [find name=("pppoe-out".$ii)] running]
:if ($status=true) do={
/ip fir man set [find new-connection-mark=$ii] nth=($x.",".$y) disable=no;:set y ($y+1)} else={
/ip fir man set [find new-connection-mark=$ii] disable=yes}}}
:if ($x=$i) do={
:set z [:len [/ip fir man find action="mark-connection" disabled=yes chain=prerouting]]
:if ($z>0) do={
:for ii from=1 to=$i do={
/ip fi man set [find new-connection-mark=$ii] nth=($x.",".$y) disable=no;:set y ($y+1)}}}}


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-17 19:53 , Processed in 0.043487 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

返回顶部