I'm setting up four servers across four locations in an attempt to create a geo-redundant MySQL Galera cluster. Two of the servers are behind NAT, and I'm currently attempting to use WireGuard to overcome this inconvenience.
Servers one and two are hosted in the cloud, and three and four are behind NAT in my home lab. I'm having three and four connect via WireGuard to BOTH one and two, so that the cluster can still operate if a cloud server goes down.
Each server has two IP addresses on every other server:
- 10.1.0.x (where x is one, two, three, or four) being routed through WireGuard on server one
- 10.2.0.x (where x is one, two, three, or four) being routed through WireGuard on server two
How would I be able to bond these two IP addresses together, so that if one WireGuard tunnel were to fail, the other one would seamlessly take over without MySQL Galera noticing?
It would be great to have 10.0.0.x (where x is one, two, three, or four) be unified IPs, and then Linux would route to whatever host(s) are currently online. I could then later add more WireGuard servers by just adding more routes, and 10.0.0.x would remain the same.
I've already tried to do this with iproute2
and route metrics, however, the WireGuard interface is never marked as "DOWN" when the remote server fails, so the switchover never happens and packet loss occurs.