benben418 发表于 2006-3-31 19:33:23

在线求解:双线策略自动切换问题,请朋友们帮忙

用的是ros2.96版,网通网关192.168.1.1,电信网关192.168.0.1,设置192.168.1.1为默认路由,
add dst-address=0.0.0.0/0 gateway=192.168.1.1 check-gateway=ping \
    distance=0 scope=255 target-scope=10 comment="" disabled=no
并添加其他电信IP段走192.168.0.1网关。
经测试,双线策略正常,问题出在断线自动切换上,自动检测网络状态正常,但是电信断线可以自动走网通网关,而网通断线却走不了电信网关,这时候只有电信段能上,网通就掉了。请大家帮忙指点一下,我的切换脚本:
设置好监控的开关

/ 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

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

第四写好脚本自动切换

/ system script
add name="dxup" source="/ip route set \ gateway \
192.168.0.1\n" policy=ftp,reboot,read,write,policy,test,winbox,password

add name="CNCup" source="/ip route set \ gateway \
192.168.1.1\n" policy=ftp,reboot,read,write,policy,test,winbox,password

add name="dxdown" source=":if \(\[/tool netwatch get \[/tool netwatch find \
comment=CNC\] status\]=\"up\"\) do {/ip route set \[/ip route find \
comment=TEL\] gateway 192.168.1.1}" \
policy=ftp,reboot,read,write,policy,test,winbox,password

add name="CNCdown" source=":if \(\[/tool netwatch get \[/tool netwatch find \
comment=TEL\] status\]=\"up\"\) do {/ip route set \[/ip route find \
comment=CNC\] gateway 192.168.0.1}" \
policy=ftp,reboot,read,write,policy,test,winbox,password

benben418 发表于 2006-4-1 10:35:53

请大家知道的帮忙指点一下。不要都沉默呀

lhn1324 发表于 2006-4-2 00:32:13

CNCup
/ip route set gateway=192.168.1.1

CNCdown
:if ( status]=up) do={/ip route set gateway=192.168.0.1

dxup
/ip route set gateway=192.168.0.1

dxdown
:if ( status]=up) do={/ip route set gateway=192.168.1.1
页: [1]
查看完整版本: 在线求解:双线策略自动切换问题,请朋友们帮忙