I’m having issues with the DNS resolution in Home Assistant. All my local hostnames are not resolved properly. Reboots don’t solve the issue. It’s not always the case though, it worked fine for quite some time and reappeared only a few days ago.
On the host (ssh root@hassio -p 22222):
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr B8:27:EB:7F:E7:62
inet addr:10.0.1.4 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: xxxxxxxxxxxxxxxxxxxxx Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7110 errors:0 dropped:0 overruns:0 frame:0
TX packets:6594 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1139758 (1.0 MiB) TX bytes:811329 (792.3 KiB)
$ cat /etc/resolv.conf
# Generated by NetworkManager
search zzzz
nameserver 10.0.1.3 <- PiHole
nameserver 10.0.1.1 <- Router
nameserver 8.8.8.8 <- Google
$ nslookup syno
Server: 10.0.1.3
Address 1: 10.0.1.3 pihole
Name: syno
Address 1: 10.0.1.2 syno.zzzz
Now the same thing from within the SSH addin (ssh root@hassio):
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 02:42:AC:1E:21:01
inet addr:172.30.33.1 Bcast:0.0.0.0 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:202 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:29652 (28.9 KiB) TX bytes:16002 (15.6 KiB)
$ cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
$ nslookup syno
nslookup: can't resolve '(null)': Name does not resolve
Name: syno
Address 1: 10.0.1.2 syno.zzzz
And now from the homeassistant container (with docker exec from within the host):
$ cat /etc/resolv.conf
nameserver 172.30.32.2
options ndots:0
$ nslookup syno
nslookup: can't resolve '(null)': Name does not resolve
nslookup: can't resolve 'syno': Name does not resolve
From that I can say that there’s something wrong with the way the DNS resolution is made from within containers. Anyone know how to fix this?