netbird icon indicating copy to clipboard operation
netbird copied to clipboard

DNS search domain is not merged with existing

Open gadamiak opened this issue 2 years ago • 2 comments

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.

gadamiak avatar Aug 09 '23 16:08 gadamiak

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

jumski avatar Apr 20 '24 09:04 jumski

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

jumski avatar Apr 30 '24 17:04 jumski