ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 6141|回复: 5

[交流] 求助双线相同带宽电信ADSL动态IP,网关做IP分流的掉线切换脚本? ...

[复制链接]
发表于 2012-12-22 00:18:27 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

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

x
新手求助双线相同带宽电信ADSL动态IP,网关做IP分流的掉线切换脚本?
发表于 2012-12-22 12:33:45 | 显示全部楼层
改下脚本就可以了,不懂就上论坛问
发表于 2012-12-24 03:41:37 | 显示全部楼层
http://bbs.mikrotik.com.cn/thread-629-1-1.html
ROS光纤 双ADSL自动切换配置,内网单号机走一条ADSL,双号机走一条ADSL

请参考这个帖子
发表于 2012-12-25 08:42:05 | 显示全部楼层
那个帖子我看过了,但看不懂,帖子里的是固定IP的,可我现在的是动态IP 动态网关
下面的是我用脚本生成器生成的双线分流,运行的很正常,就是常常其中一条线会掉线,现在不知道怎么
用脚本让它其中一条线掉线自动切换到另一条线来?

/ip address add address=192.168.1.2/255.255.255.0 interface=lan comment=lan
/ip dns set primary-dns=202.96.128.166 secondary-dns=202.96.128.86 allow-remote-requests=yes
/ip firewall nat add action=masquerade chain=srcnat src-address=192.168.1.0/255.255.255.0
/ip firewall mangle add chain=forward protocol=tcp tcp-flags=syn action=change-mss new-mss=1440
/interface pppoe-client add name="pppoe-out1" interface=WAN1 user="hz33523213.gd" password="33523213" add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out1
/ip address add address=58.58.58.1/32 interface=pppoe-out1 comment="adsl1"
/ip firewall mangle add chain=prerouting src-address=192.168.1.28-192.168.1.35 action=mark-routing new-routing-mark=adsl1 comment=adsl1
/ip route add gateway=58.58.58.1 routing-mark=adsl1 comment=adsl1
/interface pppoe-client add name="pppoe-out2" interface=WAN2 user="hz237756" password="2375666" add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out2
/ip address add address=58.58.58.2/32 interface=pppoe-out2 comment="adsl2"
/ip firewall mangle add chain=prerouting src-address=192.168.1.36-192.168.1.208 action=mark-routing new-routing-mark=adsl2 comment=adsl2
/ip route add gateway=58.58.58.2 routing-mark=adsl2 comment=adsl2



网关

:local assign-address
:local new-address
:local status
:local x
t x 2
:for i from=1 to=$x do={
t status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
:if ($status=true) do={
t new-address [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
t new-address [:pick $new-address 0 [:find $new-address "/"]]
t assign-address [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
t assign-address [:pick $assign-address 0 [:find $assign-address "/"]]
:if ($assign-address != $new-address) do={
/ip address set [/ip address find comment=("adsl" . $i)] address=$new-address network=$new-address broadcast=$new-address
/ip route set [/ip route find comment=("adsl" . $i)] gateway=$new-address
}
}
}
发表于 2014-11-20 18:29:07 | 显示全部楼层
值得收藏...












                               
登录/注册后可看大图

男装第一潮牌
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-8-6 12:37 , Processed in 0.156387 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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