Remove backup and restore for resolv.conf #555

Open
opened 2025-11-20 05:13:39 -05:00 by saavagebueno · 0 comments
Owner

Originally created by @Thunderbottom on GitHub (Dec 18, 2023).

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:

  1. Run netbird up on one network
  2. Switch to a different network which would have it's own DNS server
  3. Disconnect Netbird
  4. 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.

Originally created by @Thunderbottom on GitHub (Dec 18, 2023). **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: 1. Run `netbird up` on one network 2. Switch to a different network which would have it's own DNS server 3. Disconnect Netbird 4. 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.
saavagebueno added the bugfeature-requestsystem-compatibility-issue labels 2025-11-20 05:13:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#555