netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.04k stars 441 forks source link

Make multiple Netbird client instances cooperate on the `ip route table` level on Linux (possibly other OS too?) #2023

Open nazarewk opened 2 months ago

nazarewk commented 2 months ago

Is your feature request related to a problem? Please describe. While debugging issue with missing routes (turned out to work just fine, but uses additional table I was not aware of) and digging into the setup I have discovered my multiple Netbird instances at some point started interfering with each other's ip route tables.

Basically the last instance started seem to take over the 7120 aka netbird route table deleting all entries not owned by it, seems to happen here: https://github.com/netbirdio/netbird/blob/50201d63c2095bb5fa36d6237789d849e4b46f2a/client/internal/routemanager/manager.go#L76-L83

Describe the solution you'd like either of:

  1. The simple fix is to make those 2 values configurable: https://github.com/netbirdio/netbird/blob/50201d63c2095bb5fa36d6237789d849e4b46f2a/client/internal/routemanager/systemops_linux.go#L26-L29
  2. The longer fix would be to use the same routing table, but don't interfere with network interfaces owned by other instances (having other interfce names)

Describe alternatives you've considered see above

Additional context I am running 2 Netbird instances (private and work-related) at the same time on NixOS (Linux) through https://github.com/NixOS/nixpkgs/pull/287236

mlsmaycon commented 2 months ago

Thanks for the request @nazarewk, we will discuss it and give you an feedback soon