Dynamic routes

Robert Dahlem Robert.Dahlem at gmx.net
Tue Nov 23 23:03:02 UTC 2021


On 23.11.2021 23:40, Jonathon Fernyhough wrote:

>> The idea behind this is to have redundant tunnels. Let's say a Wireguard
>> client has a preferred server and a secondary server. Packets should be
>> routed through the preferred router while that tunnel is established and
>> through the secondary server when the preferred server is not available
>> for some reason.

> Would route metrics work for this?

Yes and no.

Metrics do useful things when there are identical prefixes with
different metrics over *working* paths. So when both tunnels are up
metrics can choose the preferred path.

With Wireguard (as far as I understand it) routes exist independently
from tunnel state. If the path through the preferred server has a better
metric, but doesn't work, the system does not fall back to the path
through the secondary server.

Metrics work fine when routes are installed/uninstalled dynamically. Say
you have a system with LAN connectivity (best metric), Wifi connectivity
(medium metric) and mobile (UMTS/LTE) connectivity (worst metric). All
of them give you a default route. If all of them are actually connected,
the system would use the route through the LAN. As soon as you unplug
the LAN cable, the LAN routes disappear and the Wifi routes are
selected. Plug the cable back in, the LAN routes reappear and the system
uses the LAN route.

Yes, metrics would work for this. But only if the routes don't appear
before a tunnel comes up and disappear when the tunnel goes down.


More information about the WireGuard mailing list