Hello everyone,
I am trying to solve the following problem and would appreciate any advice:
Problem Statement
I have a WAN
interface and two wireguard interfaces WG1
and WG2
that are connected to a single peer each (a commercial VPN for privacy reasons) and are setup to route all traffic on that interface through the peer (via "allowed IPs" being set to 0.0.0.0\0
).
Using the pbr
service, I had set-up various rules to route traffic through WAN
, WG1
and WG2
depending on sources (specified via IP or hostname) and destinations (specified via IP or domain name).
Recently, I realized that WG1
had no internet access, because of some problem with the peer, and some service was not accessible.
What I want to achieve now is to have a form of failover, that routes the traffic that is supposed to go over WG1
over WG2
in case that WG1
has no internet connection.
Solution attempts
-
First I tried to use a
pbr
configuration without strict enforcement, adding a rule forWG2
after the ones forWG1
. So if the interfaceWG1
is down, it should use the next matching rule.
However, the problem here is that in this situation theWG1
is not down - it simply provides has no internet connection. -
Then I thought maybe I could set-up multiple peers in the
WG1
interface. But this does not seem to work, since I cannot "magically" make the wireguard interface switch the routing options. Also, how would it know that one peer does not have internet access. -
After reading up a little I stumbled about the
mwan3
package. After reading some tutorials, I thought the correct way would configure the whole policy based routing inmwan3
(even though I find it more complicated to set-up the rules), but as I understand it, domain-based routing for the destinations or hostname-based routing for the sources cannot be configured there.
Questions
- Is there any way to still achieve my original goal with OpenWRT?
In order to achieve that I am willing to- change my firmware version (at the moment I am on
23.05
) - have
mwan3
andpbr
both running if necessary to achieve my goals - use the
cli
instead ofluci
, even though I am used to the latter. - using VLANs, even though I have no experience on that regard; but I am willing to learn
- change my firmware version (at the moment I am on
- If this is not possible at all, what is the closest that I could achieve?