DNS search domain is not merged with existing #413

Open
opened 2025-11-20 05:11:04 -05:00 by saavagebueno · 3 comments
Owner

Originally created by @gadamiak on GitHub (Aug 9, 2023).

Describe the problem
On setting the DNS in the /etc/resolv.conf NetBird adds the search domain netbird.cloud in the beginning of the file. That works fine for nameserver as any following entry above 3 is ignored. However, it fails if there is the search domain defined already, as the latest one overwrites the previous. In a result, short hostnames don't work. Instead, the search should be prepended with NetBird entry.

To Reproduce
Steps to reproduce the behavior:

  1. Disconnect
  2. Add any search list to the /etc/resolv.conf
  3. Connect
  4. Try to resolve the short host name in netbird.cloud domain
  5. See could not resolve hostname error

Expected behavior
The short hostname in netbird.cloud domain should resolve correctly

NetBird status -d output:
Daemon version: 0.22.3
CLI version: 0.22.3

Screenshots

$ netbird down                                                 
$ cat /etc/resolv.conf
# Generated by NetworkManager
search home                                                   
nameserver 192.168.1.1
$ netbird up
Connected
$ cat /etc/resolv.conf
# Generated by NetBird
# If needed you can restore the original file by copying back /etc/resolv.conf.original.netbird

nameserver 100.83.213.23
search  netbird.cloud

# Generated by NetworkManager
search home
nameserver 192.168.1.1
$ host work
$ host work.netbird.cloud
work.netbird.cloud has address 100.83.213.23

Additional context
As per the resolv.conf man page:

If there are multiple search directives, only the search list from the last instance is used.

Originally created by @gadamiak on GitHub (Aug 9, 2023). **Describe the problem** On setting the DNS in the `/etc/resolv.conf` NetBird adds the `search` domain `netbird.cloud` in the beginning of the file. That works fine for `nameserver` as any following entry above 3 is ignored. However, it fails if there is the `search` domain defined already, as the latest one overwrites the previous. In a result, short hostnames don't work. Instead, the `search` should be prepended with NetBird entry. **To Reproduce** Steps to reproduce the behavior: 1. Disconnect 2. Add any `search` list to the `/etc/resolv.conf` 3. Connect 4. Try to resolve the short host name in `netbird.cloud` domain 5. See could not resolve hostname error **Expected behavior** The short hostname in `netbird.cloud` domain should resolve correctly **NetBird status -d output:** Daemon version: 0.22.3 CLI version: 0.22.3 **Screenshots** ~~~ $ netbird down $ cat /etc/resolv.conf # Generated by NetworkManager search home nameserver 192.168.1.1 $ netbird up Connected $ cat /etc/resolv.conf # Generated by NetBird # If needed you can restore the original file by copying back /etc/resolv.conf.original.netbird nameserver 100.83.213.23 search netbird.cloud # Generated by NetworkManager search home nameserver 192.168.1.1 $ host work $ host work.netbird.cloud work.netbird.cloud has address 100.83.213.23 ~~~ **Additional context** As per the `resolv.conf` man page: > If there are multiple search directives, only the search list from the last instance is used.
saavagebueno added the bugclientsystem-compatibility-issue labels 2025-11-20 05:11:04 -05:00
Author
Owner

@jumski commented on GitHub (Apr 20, 2024):

I confirm this issue and handle this currently by manually managing my /etc/resolv.conf file, which is extremely unfeasible :-(

@jumski commented on GitHub (Apr 20, 2024): I confirm this issue and handle this currently by manually managing my `/etc/resolv.conf` file, which is extremely unfeasible :-(
Author
Owner

@jumski commented on GitHub (Apr 30, 2024):

after some of last updates it seems to resolve itself for me, see https://github.com/netbirdio/netbird/issues/1559#issuecomment-2086048625

@jumski commented on GitHub (Apr 30, 2024): after some of last updates it seems to resolve itself for me, see https://github.com/netbirdio/netbird/issues/1559#issuecomment-2086048625
Author
Owner

@nazarewk commented on GitHub (Apr 23, 2025):

is it still an issue for you with latest NetBird version?

@nazarewk commented on GitHub (Apr 23, 2025): is it still an issue for you with latest NetBird version?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#413