找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2776|回复: 1

[策略设置] 2.9.X 电信adsl+网通adsl 2条ADSL 自动策略路由切换+备份

[复制链接]
发表于 2008-4-14 20:48:11 | 显示全部楼层 |阅读模式

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

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

×
2.9.X 电信adsl+网通adsl 2条ADSL 自动策略路由切换+备份

希望 启用这个策略的朋友 在实际使用中的反馈即时和我沟通,包括网通的网关

不一定会很全,但是可以保证100% 能用

第1 ip设好

/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 \
interface=lan comment="" disabled=no

这里的ADSL的IP是我假设的,你自己的要根据你自己的动态IP设置

电信=ADSL1
电信IP=172.16.20.123/32
网关=172.16.20.1

网通=ADSL2
网通IP=172.168.20.253/32
网关=172.168.20.1

记住要改MSS

/ ip firewall mangle
add chain=forward protocol=tcp tcp-flags=syn \
action=change-mss new-mss=1400 comment="" disabled=no

/ ip firewall nat
add chain=srcnat src-address=192.168.0.0/24 action=masquerade comment="" \
disabled=no

--------------------------------------------------------------------------------------------------

第2步 添加 网通的路由网关

电信的服务器在网络中占了绝大多数

所以不需要考虑电信的服务器,把电信网关和网通网关修改为你自己的获取的网关就可以了.

/ ip route
add dst-address=0.0.0.0/0 gateway=adsl1网关 check-gateway=ping \
      distance=0 scope=255 target-scope=10 comment="adsl1" disabled=no
add dst-address=0.0.0.0/0 gateway=adsl2网关 check-gateway=ping \
      distance=0 scope=255 target-scope=10 comment="adsl2" disabled=no
add dst-address=58.16.0.0/16 gateway=网通adsl2网关 check-gateway=ping \
    distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
.......................略

注意comment=adsl1,adsl2和CNC的注译.

电信网通的路由表生成器在软路由论坛去下载,我发布的不是最新的,但是可以用.

下载地址 http://bbs.routerclub.com/thread-30982-1-1.html


-------------------------------------------------------------------------------------------

第3步 设置好监控的开关 在 tool netwatch里添加

/ tool netwatch
add host=adsl1网关 timeout=1s interval=1m
up-script=
/ip route set [/ip route find comment=adsl1] gateway [/ip address get [/ip address find interface=pppoe-out1] network]
down-script=
/ip route set [/ip route find comment=adsl2] gateway [/ip address get [/ip address find interface=pppoe-out2] network]

第4步 自动获取ADSL的网关

对于双adsl接入且一个是网通一个是电信的情况下.先把路由的网关乱设好一个,然后用这个脚本来把网关改为拨号后自动获取的网关,加在Scheduler里,Name=CNCget Interval=00:00:10


:local assign-address
:local new-address

:set assign-address [/ip route get[/ip route find comment=CNC] gateway]
:set new-address [/ip address get[/ip address find interface=pppoe-out1] network]

:if ($assign-address != $new-address) do={/ip route set[/ip route find comment=CNC] gateway=$new-address}.

这样就是双ADSL的策略路由,我不是高手,只是ros的初学者有不对的地方请各位指教,谢谢就写到这里了,

[ 本帖最后由 xsjfj 于 2008-4-15 08:37 编辑 ]
routeros
发表于 2008-4-16 16:50:05 | 显示全部楼层

多线掉线自动切换脚本求助!

大哥,能不能写个3线ADSL或更多线的ADSL的掉线自动切换脚本呀.小弟不知怎么搞呀,头都大了,做个列样好么,谢谢!
如能帮忙,请发到我的邮箱,小弟万分感谢 luhong_1979@163.com
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-28 19:17 , Processed in 0.067313 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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