找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 16991|回复: 38

[脚本] 负载均衡防掉线脚本无限制版本

  [复制链接]
发表于 2010-1-18 14:02:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
pcc撤换.rar (565 Bytes, 下载次数: 567) 负载均衡防掉线脚本
routeros
发表于 2010-1-18 14:28:13 | 显示全部楼层
呵呵 呵呵 不错 。。有待改进 呵呵 光背也出新鲜玩意了
routeros
回复

使用道具 举报

发表于 2010-1-20 18:58:31 | 显示全部楼层
哪个版本的??
routeros
回复

使用道具 举报

发表于 2010-1-20 20:03:03 | 显示全部楼层
我发一个能正常用的吧

:local pccstatus
:local status
:local pccold
:local pccnew
:local link
:local ncm
:local nrm
:local y
:local z
:local x
:set x 4
:set link 0
:for i from=1 to="$x" do={
    :set status [/interface get [/interface find  name=("pppoe-out" . "$i")] running]
    :if ("$status" = true) do={
    :set link ($link + 1)
  }
}
:if ("$link" > 1) do={
    :set z "$link"
    :set y 0
    :for i from=1 to="$x" do={
         :set status [/interface get [/interface find  name=("pppoe-out" . "$i")] running]
         :set ncm ("adsl" . "$i" . "conn")
         :set nrm ("ADSL" . "$i")
         :if ("$status" = true) do={
                    :set pccnew ("both-addresses" . ":" . "$z" . "/" . "$y")
                    :set pccold [/ip firewall mangle get [ /ip firewall mangle find chain=bonding new-connection-mark="$ncm"] per-connection-classifier]
                    :set pccstatus [/ip firewall mangle get [/ip firewall mangle find chain=bonding new-connection-mark="$ncm"] disable]
                    :if (("$pccnew" != $pccold) || ("$pccstatus" = true)) do={
                          /ip firewall mangle set [ /ip firewall mangle find chain=bonding new-connection-mark="$ncm"] per-connection-classifier=$pccnew disabled=no
                          /ip firewall mangle set [ /ip firewall mangle find chain=bonding new-routing-mark="$nrm"] disabled=no
                      }
             :set y ($y + 1)
          } else {
                  :set pccstatus [/ip firewall mangle get [/ip firewall mangle find chain=bonding new-connection-mark="$ncm"] disable]
                  :if ("$pccstatus" = false) do={
                         /ip firewall mangle disable [ /ip firewall mangle find chain=bonding new-connection-mark="$ncm"]
                         /ip firewall mangle disable [/ip firewall mangle find chain=bonding new-routing-mark="$nrm"]
             }
        }
    }
  }
}
routeros
回复

使用道具 举报

发表于 2010-1-20 20:21:54 | 显示全部楼层
就是嘛 这才看起来 不错的样子
routeros
回复

使用道具 举报

 楼主| 发表于 2010-1-21 16:07:09 | 显示全部楼层
你这个也不是一般人会用
routeros
回复

使用道具 举报

发表于 2010-1-22 23:27:46 | 显示全部楼层
都不错,又收到好东西了
routeros
回复

使用道具 举报

发表于 2010-1-23 01:14:13 | 显示全部楼层
顶一下精彩!!
routeros
回复

使用道具 举报

发表于 2010-2-20 22:53:35 | 显示全部楼层
收藏一下啦。呵呵
routeros
回复

使用道具 举报

发表于 2011-2-24 20:10:20 | 显示全部楼层
下载来看看,我都看不懂
routeros
回复

使用道具 举报

发表于 2011-2-25 00:56:34 | 显示全部楼层
谢谢楼主分享
routeros
回复

使用道具 举报

发表于 2011-2-27 10:01:41 | 显示全部楼层
哪个版本上用的?~
routeros
回复

使用道具 举报

发表于 2011-3-20 23:04:23 | 显示全部楼层
谢谢楼主分享
routeros
回复

使用道具 举报

发表于 2011-3-21 02:34:06 | 显示全部楼层
   是一种学习  
routeros
回复

使用道具 举报

发表于 2011-3-21 22:04:26 | 显示全部楼层
也不知道现在ros技术到什么地步了
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-10 11:17 , Processed in 0.086597 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表