Description
Describe the problem
Netbird creates a backup of /etc/resolv.conf
whenever a system is connected to netbird, and restores the backup file whenever netbird is disconnected. This might be problematic in cases where the backup resolv.conf
contains nameserver entries that are local to the connected network and not available universally. For example, I have a DNS server running on my home network that gets added to the resolv.conf automatically. When I run netbird up
, netbird creates a backup of this resolv.conf. If and when the network is switched, let's say to an office network in a different (physical) location, and netbird is disconnected, the original resolv.conf backed up by netbird is restored, which contains the home's DNS servers, which would not work, causing DNS resolutions to fail unless the resolv.conf
is manually changed.
To Reproduce
Steps to reproduce the behavior:
- Run
netbird up
on one network - Switch to a different network which would have it's own DNS server
- Disconnect Netbird
- The backup
resolv.conf
from the first network gets restored, causing DNS to fail.
Expected behavior
DNS should not fail when netbird is disconnected after switching networks.
Additional context
Netbird currently appends its DNS nameservers to the existing resolv.conf, making the current backup/restore mechanism redundant and unnecessary. Whenever netbird is disconnected, it should just remove its entries from resolv.conf instead of handling the backup/restore as well.