找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2768|回复: 2

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

[复制链接]
发表于 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 \[/ip route find comment=TEL\] gateway \
  192.168.0.1\n" policy=ftp,reboot,read,write,policy,test,winbox,password

add name="CNCup" source="/ip route set \[/ip route find comment=CNC\] 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
routeros
 楼主| 发表于 2006-4-1 10:35:53 | 显示全部楼层
请大家知道的帮忙指点一下。不要都沉默呀
routeros
回复

使用道具 举报

发表于 2006-4-2 00:32:13 | 显示全部楼层
CNCup
/ip route set [/ip route find dst-address=0.0.0.0/0] gateway=192.168.1.1

CNCdown
:if ([/tool netwatch get [/tool netwatch find host=192.168.0.1] status]=up) do={/ip route set [/ip route find dst-address=0.0.0.0/0] gateway=192.168.0.1

dxup
/ip route set [/ip route find comment=TEL] gateway=192.168.0.1

dxdown
:if ([/tool netwatch get [/tool netwatch find host=192.168.1.1] status]=up) do={/ip route set [/ip route find comment=TEL] gateway=192.168.1.1
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-30 19:39 , Processed in 0.045061 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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