Vpn issues with mwan3

Hi, I'm using mwan3-2.6.18 and using 2 wan for load-balancing. It was working fine till I implemented ipsec, l2tp, and openvpn. When mwan3 running these VPNs are not working and found there was a default route entry in the kernel route table using the loopback interface because in the mwan3 config file
option local_source 'lan'
When I change this "none" loopback route entry is removed and the VPN connects well. But there is a new problem has arisen my router can't get ping to the internet when the primary link is down where the LAN network is getting internet. I also found the primary wan route entry still in the kernel table even though it's down and when removed the primary route entry router gets internet as well.

I have tried to change the mwan3 packages to 2.7.0 using this link: https://github.com/openwrt/packages/pull/6515/files

Still, I'm facing the same issue of the router not getting internet when the primary wan down but the LAN works well.

N.B: I'm using some old version of openwrt-18.06.2 for some dependencies I can't update my openwrt version.

This is a well-known issue with mwan3:

Is there any option to run failover without mwan3. Like PBR?

It depends on the type of your connections. If the main connection fails by the interface disconnecting (like is the case with PPPoE), then yes - just set the metrics. If they just appear connected but don't actually work, then no.

PBR will not help, it is useful for creating rules about which traffic goes over which connection, while assuming that all connections are always up.

There is also an unofficial "simplefailover" package (thanks to @IceG) that I have not tested:

https://dl.eko.one.pl/openwrt-23.05/packages/aarch64_cortex-a53/base/simplefailover_20160218_all.ipk

As a possible workaround, you could use /etc/mwan3.user to modify the main routing table when the primary wan interface goes down/up.

Create a new default route via wanb with a metric lower than that of wan if the connection is lost, and remove it when it is restored.

if [ "$ACTION" = "disconnected" -a "$INTERFACE" = "wan" ]; then
       newroute=$(ip route show default metric 20)
       ip route add $newroute metric 2
fi

if [ "$ACTION" = "connected" -a "$INTERFACE" = "wan" ]; then
       ip route del default metric 2 2>/dev/null
fi

The example assumes that wanb has a metric of 20.

1 Like