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.88k stars 493 forks source link

DNS search domain is not merged with existing #1070

Open gadamiak opened 1 year ago

gadamiak commented 1 year ago

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.

jumski commented 5 months ago

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

jumski commented 5 months ago

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