OpenWRT 随机断网解决方案

百善孝为先,论心不论迹,论迹贫家无孝子;
万恶淫为首,论迹不论心,论心世上少完人。

——《围炉夜话》清/王永彬

最近折腾便宜小巧软路由 R2S ,安装 OpenWRT 系统后时不时的连接失败,最终查明原因,贴出解决方案。

一、问题

  • 表征问题: 随机断网,ubuntu 网络接口小问号。
  • 物理设备: R2S 主路由,接 NETGEAR GS308 8口千兆交换机,接无线路由。
  • 系统日志:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Wed Nov 25 20:28:54 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:28:54 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:28:59 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:28:59 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:04 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:29:04 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:10 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:29:10 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:15 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:29:15 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:22 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:27 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.114.114" on interface wan (eth0)
    Wed Nov 25 20:29:27 2020 user.info mwan3track[24520]: Check (ping) success for target "114.114.115.115" on interface wan (eth0)
    Wed Nov 25 20:29:27 2020 user.info mwan3track[24520]: Lost 1 ping(s) on interface wan (eth0)

    二、解决方案

负载均衡 MWAN3 设置错误,是 MWAN3 这里的检测端口是否在线的 DNS 被墙了,3次 ping 失败就认为端口离线了,换成国内的 DNS 或者把检测开关关掉。

网络-负载均衡下修 WAN 口设置,跟踪的主机或 IP 地址为国内 DNS 。或直接不启用。或直接删除 WAN 口设置。

跟踪的主机或 IP 地址为阿里 DNS 223.5.5.5 后日志显示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Wed Nov 25 20:56:31 2020 user.notice mwan3rtmon[4274]: Stopping mwan3rtmon...
Wed Nov 25 20:56:33 2020 user.notice mwan3track[24308]: Stopping mwan3track for interface "wan"
Wed Nov 25 20:56:45 2020 user.notice mwan3[31357]: Using firewall mask 0x3F00
Wed Nov 25 20:56:45 2020 user.notice mwan3[31357]: Max interface count is 60
Wed Nov 25 20:56:46 2020 user.notice mwan3[31357]: Execute ifup event on interface wan (eth0)
Wed Nov 25 20:56:46 2020 user.notice mwan3[31357]: Starting tracker on interface wan (eth0)
Wed Nov 25 20:56:47 2020 user.notice firewall: Reloading firewall due to ifup of wan (eth0)
Wed Nov 25 20:56:57 2020 user.notice mwan3[32104]: Execute ifdown event on interface wan (eth0)
Wed Nov 25 20:56:58 2020 user.info mwan3track[31660]: Detect ifdown event on interface wan (eth0)
Wed Nov 25 20:57:03 2020 user.notice mwan3track[31660]: Interface wan (eth0) is offline
Wed Nov 25 20:57:03 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)
Wed Nov 25 20:57:08 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)
Wed Nov 25 20:57:13 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)
Wed Nov 25 20:57:18 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)
Wed Nov 25 20:57:24 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)
Wed Nov 25 20:57:29 2020 user.info mwan3track[31660]: Check (ping) success for target "223.5.5.5" on interface wan (eth0)