netbirdio / netbird

Connect your devices into a single secure private WireGuard®-based mesh network with SSO/MFA and simple access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
9.83k stars 425 forks source link

search domains only adds subdomain of the agent #2118

Open ez1976 opened 3 weeks ago

ez1976 commented 3 weeks ago

Hello. when netbird agent is connected, the search domain that is added to /etc/resolv.conf is taken from the hostnamectl. but it configures the full subdomain and ignores anything from the domain itself.

options: 1) only the domain should be added and not only the subdomain 2) use the DOMAIN in the ifcfg configurations 3) append the netbird internal domain to the existing search line in the /etc/resolv.conf and not changing the whole line for example:

[root@rd04 ~]#hostnamectl Static hostname: rd04.it.qwilt.com Icon name: computer-server Chassis: server Machine ID: 5686d4f4b0594891a22e2dfdd844b3ae Boot ID: dcf86e33e95148639087f37fd8460d57 Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.3.2.el7.x86_64 Architecture: x86-64 [root@rd04 ~]#cat /etc/resolv.conf

Generated by NetBird

If needed you can restore the original file by copying back /etc/resolv.conf.original.netbird

options timeout:4 attempts:1 search ztna.qwilt.com it.qwilt.com nameserver 100.120.255.254 [root@rd04 ~]#

BUT in the ifcfg config file the search domain is being ignored: cat /etc/sysconfig/network-scripts/ifcfg-enp15s0f0 | grep DOMAIN DOMAIN=qwilt.com

so any resolve that we use that is hostname.subdomain are being ignored [root@rd04 ~]#ping mvm15.it ping: mvm15.it: Name or service not known [root@rd04 ~]#ping mvm15 PING us-w1-mvm15.it.qwilt.com (100.120.151.203) 56(84) bytes of data. 64 bytes from 100.120.151.203 (100.120.151.203): icmp_seq=1 ttl=64 time=213 ms 64 bytes from 100.120.151.203 (100.120.151.203): icmp_seq=2 ttl=64 time=213 ms ^C --- us-w1-mvm15.it.qwilt.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 213.696/213.731/213.767/0.463 ms [root@rd04 ~]#

the only way to resolve this is by changing the hostname to rd14.qwilt.com then the qwilt.com domain is added and the search works.

root@rd04 ~]#hostnamectl set-hostname rd14.qwilt.com [root@rd04 ~]#hostnamectl Static hostname: rd14.qwilt.com Icon name: computer-server [root@rd04 ~]#cat /etc/resolv.conf | grep search search ztna.qwilt.com qwilt.com [root@rd04 ~]#

[root@rd04 ~]#ping mvm15.it PING us-w1-mvm15.it.qwilt.com (100.120.151.203) 56(84) bytes of data. 64 bytes from 100.120.151.203 (100.120.151.203): icmp_seq=1 ttl=64 time=213 ms ^C --- us-w1-mvm15.it.qwilt.com ping statistics --- 2 packets transmitted, 1 received, 50% packet loss, time 1000ms rtt min/avg/max/mdev = 213.753/213.753/213.753/0.000 ms [root@rd04 ~]#