|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
2.9.X 电信+网通1条ADSL自动策略路由切换+备份
第一 ip设好
/ ip address
add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 \
interface=LAN comment="" disabled=no
add address=电信地址/掩码 network=自动设置 broadcast=自动设置
interface=TEL comment="" disabled=no
内网=192.168.1.1/24 网卡设置为LAN
假设的IP
电信=218.63.213.6/32 网卡设置为TEL
网关=218.63.213.1
网通=ADSL 网卡设置为CNC
网通IP=172.16.20.253/32
网关=172.16.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.1.0/24 action=masquerade comment="" \
disabled=no
--------------------------------------------------------------------------------------------------
第2步 添加 网通的路由网关
电信的服务器在网络中占了绝大多数
所以不需要考虑电信的服务器,把电信网关和网通网关修改为你自己的获取的网关就可以了.
/ ip route
add dst-address=59.80.0.0/14 gateway=网通网关 check-gateway=ping \
distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
....................
add dst-address=0.0.0.0/0 gateway=电信网关 check-gateway=ping \
distance=0 scope=255 target-scope=10 comment="TEL" disabled=no
add dst-address=0.0.0.0/0 gateway=网通网关 check-gateway=ping \
distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
注意comment=TEL和CNC的注译.
电信网通的路由表生成器在软路由论坛去下载,我发布的不是最新的,但是可以用.
下载地址 http://bbs.routerclub.com/thread-30982-1-1.html
-------------------------------------------------------------------------------------------------------
第3步 设置好监控的开关
/ tool netwatch
add host=电信网关 timeout=1s interval=1m up-script=dxup \
down-script=dxdown comment="TEL" disabled=no
add host=网通网关 timeout=1s interval=1m up-script=CNCup \
down-script=CNCdown comment="CNC" disabled=no
--------------------------------------------------------------------------------------------------------
第四写好脚本自动切换 第一种方法ros的脚本加在script里面的
dxup
/ip route set [/ip route find comment=TEL] gateway 电信网关
cncup
/ip route set [/ip route find comment=CNC] gateway [/ip address get [/ip address find interface=pppoe-out1] network]
dxdown
/ip route set [/ip route find comment=CNC] gateway [/ip address get [/ip address find interface=pppoe-out1] network]
cncdown
/ip route set [/ip route find comment=TEL] gateway 电信网关
----------------------------------------------------------------------
思路:
对于双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}
有不对的地方请指教,我是新学.
[ 本帖最后由 xsjfj 于 2008-4-15 08:38 编辑 ] |
|