netbird
netbird copied to clipboard
DNS search domain is not merged with existing
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:
- Disconnect
- Add any
searchlist to the/etc/resolv.conf - Connect
- Try to resolve the short host name in
netbird.clouddomain - 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.
I confirm this issue and handle this currently by manually managing my /etc/resolv.conf file, which is extremely unfeasible :-(
after some of last updates it seems to resolve itself for me, see https://github.com/netbirdio/netbird/issues/1559#issuecomment-2086048625