找回密码
 加入我们
搜索
      
查看: 4646|回复: 4

分享RouterOSv7下多线宽带故障转移设置

[复制链接]
发表于 2022-8-14 16:20 | 显示全部楼层 |阅读模式
一般家用就是路由表的pppoe相关条目上启用check-gateway=ping就完事了。但这只是检测本地-ISP的链路是否正常,ISP-公网出了故障无法被检测。

实际上我们需要检测到公网的链路是否正常就要用递归路由(recursive routing)的方式,欺骗设备下一跳为某个非直连的ip地址(一般为公网DNS地址)。

注意参考这个脚本https://gist.github.com/marfilla ... ac22f2849e099a1c6a1

其中关键是这一坨
  1. # recursive routes for default gateways, dst-address are public DNS servers
  2. add dst-address=64.6.64.6/32 gateway=ether1 scope=10 comment="ISP1"
  3. add dst-address=208.67.220.220/32 gateway=ether1 scope=10 comment="ISP1"
  4. add dst-address=208.67.222.222/32 gateway=ether2 scope=10 comment="ISP2"
  5. add dst-address=64.6.65.6/32 gateway=ether2 scope=10 comment="ISP2"

  6. # load-balanced w/ auto failover default gateways
  7. add check-gateway=ping distance=1 dst-address=0.0.0.0/0 gateway=64.6.64.6 routing-table=to_ISP1 scope=10 target-scope=11
  8. add check-gateway=ping distance=2 dst-address=0.0.0.0/0 gateway=64.6.65.6 routing-table=to_ISP1 scope=10 target-scope=11
  9. add check-gateway=ping distance=1 dst-address=0.0.0.0/0 gateway=208.67.222.222 routing-table=to_ISP2 scope=10 target-scope=11
  10. add check-gateway=ping distance=2 dst-address=0.0.0.0/0 gateway=208.67.220.220 routing-table=to_ISP2 scope=10 target-scope=11
复制代码


scope=10代表下一跳为直连 64.6.64.6 64.6.65.6这些都是外网dns,实际替换为国内dns地址即可。
发表于 2022-8-14 16:38 | 显示全部楼层
感谢分享此技术
发表于 2022-8-15 11:57 | 显示全部楼层
腳本好用~牛
发表于 2022-8-15 18:03 | 显示全部楼层
收藏一下。点赞
发表于 2022-8-15 18:21 | 显示全部楼层
国内dns 会一直变么?
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

Archiver|手机版|小黑屋|Chiphell ( 沪ICP备12027953号-5 )沪公网备310112100042806 上海市互联网违法与不良信息举报中心

GMT+8, 2024-5-19 23:53 , Processed in 0.008252 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2007-2024 Chiphell.com All rights reserved.

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