supervisor: DNS resolution fails from within the containers

After posting on hassio forum and discussion on Discord, I’ve been advised to open an issue here.

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

So the funny thing is that it works when I configure my DHCP (on the router) not to advertise the DNS 10.0.1.3. And when I add it back it stops working again.

The logs on the DNS server on 10.0.1.3 don’t show any activity when I nslookup from within the homeassistant container but it works fine on the host and I can see the logs.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Oops, I just realised after reading your post that hass.io got renamed hass os and the image I flashed earlier was actually hassos_rpi3-1.12.img.gz

I’m still not about to resolve .local IP addresses either in or out of containers however, did you change any settings from a stock install? Thanks