双线路策略路由和脚本备份切换
电信和网通的双线路策略路由.并且在其中一条线路断掉后自动切换为单线路,线路恢复后,恢复使用策略路由.
电信网关 190.168.1.10
网通网关 192.168.1.9
1 先设置用电信线路上网.
2.添加网通独立的路由表.
CODE / ip policy-routing table test1
add dst-address=0.0.0.0/0 gateway=192.168.1.9 preferred-source=0.0.0.0 comment="" disabled=no
3 在rule里添加策略路由规则
CODE / ip policy-routing rule
add src-address=0.0.0.0/0 dst-address=59.80.0.0/14 flow="" interface=all action=lookup table=test1 \
comment="" disabled=no
..
..
此处省略
记得把main移动到最后
4、配置自动切换脚本
CODE / system script
add name="test1down" source="/ ip policy-routing table test1
\nset \[/ ip policy-routing table test1 find \
dst-address=0.0.0.0\] gateway 190.168.1.10
\n" policy=ftp,reboot,read,write,policy,test
add name="test1up" source="/ ip policy-routing table test1
\nset \[/ ip policy-routing table test1 find \
dst-address=0.0.0.0\] gateway 192.168.1.9
\n" policy=ftp,reboot,read,write,policy,test
add name="maindown" source="/ ip policy-routing table main
\nset \[/ ip policy-routing table main find \
dst-address=0.0.0.0\] gateway 192.168.1.9" policy=ftp,reboot,read,write,policy,test
add name="mainup" source="/ ip policy-routing table main
\nset \[/ ip policy-routing table main find \
dst-address=0.0.0.0\] gateway 190.168.1.10" policy=ftp,reboot,read,write,policy,test
5 配置NETWATCH用于监视网络的通断情况
CODE / tool netwatch
add host=190.168.1.10 timeout=1s interval=20s up-script=mainup down-script=maindown comment="" disabled=no
add host=192.168.1.9 timeout=1s interval=20s up-script=test1up down-script=test1down comment="" disabled=no 文章录入:csh 责任编辑:csh