I have a OpenWRT SNAPSHOT r24936-60ffcfdabc running on an x86 system with dual Internet connections. The primary Internet connection, WAN, is configured with a gateway metric of 10, the secondary Internet connection, WAN2, is configured with a gateway metric of 20. Both are always-on connections, not on-demand.
The gateway metrics are working as expected, all my traffic defaults to through the WAN connection unless it is down, in which case WAN2 is used.
The issue is with Wireguard. When the Wireguard tunnel comes up, there is an automatic route added to the routing table for the peer address using the gateway from the WAN interface and the same metric (10).
WAN 204.x.x.1 198.x.x.1 10 main
When WAN goes down, the automatic route goes away, and a new one appears pointing to the gateway of WAN2
WAN 204.x.x.1 202.x.x.1 20 main
When WAN comes back up, however, that new route entry remains, and the Wireguard tunnel continues to be routed through WAN2.
These route entries make sense, in that you want to maintain route persistence to some extent, but prevent the connection from being reverted to the primary WAN connection after it comes up.
Is there a setting somewhere that I can use to prevent this automatic route from being added? Can I override it by adding static routes of my own?