找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1960|回复: 2

[其它] 双ADSL动态网关掉线自动切换

[复制链接]
发表于 2007-9-21 18:36:59 | 显示全部楼层 |阅读模式

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

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

×
参考ZOOYO版主的ADSL动态网关修改的,本人没条件试验.  如有不明参考ADSL动态网关脚本和光纤与ADSL在网吧的应用
http://bbs.routerclub.com/thread-18165-1-1.html
一条断线自动切换到另一条:

:if ([/in pppoe-c get [find name=pppoe-out1] running]=false) do {
:global adsl "pppoe-out2"
:global new-ip [ /ip address get [/ip address find broa=0.0.0.0 int=$adsl] network ]
:global old-ip [ /ip route get [/ip route find comm="adsl1"] gateway ]
:if ($new-ip != $old-ip) do={
        :log info [/ip route set [/ip route find comm="adsl1"] gateway=$new-ip]
        :log info "〖1线中断转到2线〗"
       }
}


:if ([/in pppoe-c get [find name=pppoe-out2] running]=false) do {
:global adsl "pppoe-out1"
:global new-ip [ /ip address get [/ip address find broa=0.0.0.0 int=$adsl] network ]
:global old-ip [ /ip route get [/ip route find comm="adsl2"] gateway ]
:if ($new-ip != $old-ip) do={
        :log info [/ip route set [/ip route find comm="adsl2"] gateway=$new-ip]
        :log info "〖2线中断转到1线〗"
       }
}


线路恢复:

:if ([/in pppoe-c get [find name=pppoe-out1] running]=true) do {
:global adsl "pppoe-out1"
:global new-ip [ /ip address get [/ip address find broa=0.0.0.0 int=$adsl] network ]
:global old-ip [ /ip route get [/ip route find comm="adsl1"] gateway ]
:if ($new-ip != $old-ip) do={
        :log info [/ip route set [/ip route find comm="adsl1"] gateway=$new-ip]
        :log info "〖1线网络恢复〗"
       }
}

:if ([/in pppoe-c get [find name=pppoe-out2] running]=true) do {
:global adsl "pppoe-out2"
:global new-ip [ /ip address get [/ip address find broa=0.0.0.0 int=$adsl] network ]
:global old-ip [ /ip route get [/ip route find comm="adsl2"] gateway ]
:if ($new-ip != $old-ip) do={
        :log info [/ip route set [/ip route find comm="adsl2"] gateway=$new-ip]
        :log info "〖2线网络恢复〗"
       }
}


引用ZOOYO版主一句:  这是路由表,大家一定要加入comment标签,我写的脚本是通过comment来判断的!
routeros
发表于 2009-4-11 13:16:16 | 显示全部楼层
有没有测试过。。 能不能用啊!
routeros
回复

使用道具 举报

发表于 2009-4-12 01:03:44 | 显示全部楼层
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 15:38 , Processed in 0.085333 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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