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.
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:
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