Docker DNS (172.30.32.2:53) slow to respond for add-ons when running AdGuard/Pi-hole

Hi,

I’ve got the latest version of Hass.io (supervisor 150, HassOS 2.11) ova running in VirtualBox. Whenever I start any DNS add-on (AdGuard or Pi-hole), all add-ons and integrations can no longer contact the outside world. Looking through various logs I see messages such as:

tcp: lookup adguardteam.github.io on 172.30.32.2:53: read udp 172.30.32.1:39241->172.30.32.2:53: i/o timeout
[API] ConnectionError: HTTPConnectionPool(host='api.platformio.org', port=80): Max retries exceeded with url: /v2/lib/search?query=name%3A%22ESP8266WiFi%22 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4858b4c810>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) (incremented retry: max=5, total=1)

I’ve followed the instructions to set up static IP and DNS for HassOS here with the DNS set to 1.1.1.1;8.8.8.8, and verified the settings with nmcli in HassOS console.

nslookup from HassOS works fine:

# time nslookup bing.com
Server:        1.1.1.1
Address:       1.1.1.1:53

Non-authoritative answer:
Name:   bing.com
Address: 2620:1ec:c11::200

Non-authoritative answer:
Name:   bing.com
Address: 204.79.197.200
Name:   bing.com
Address: 13.107.21.200

real    0m 0.02s
user    0m 0.00s
sys     0m 0.01s

However, nslookup from the Hassio container is very slow:

core-ssh:~# time nslookup bing.com 172.30.32.2
Server:    172.30.32.2
Address 1: 172.30.32.2 hassio

Name:      bing.com
Address 1: 204.79.197.200 a-0001.a-msedge.net
Address 2: 13.107.21.200
Address 3: 2620:1ec:c11::200

real    0m16.055s
user    0m0.000s
sys     0m0.002s

When I stop the DNS add-on nslookup performs as expected, and all the other add-ons work:

core-ssh:~# time nslookup bing.com 172.30.32.2
Server:    172.30.32.2
Address 1: 172.30.32.2 hassio

Name:      bing.com
Address 1: 204.79.197.200 a-0001.a-msedge.net
Address 2: 13.107.21.200
Address 3: 2620:1ec:c11::200

real    0m0.098s
user    0m0.000s
sys     0m0.003s

Any ideas why running the DNS add-ons would cause DNS lookup to take so long, but only within Docker containers that shouldn’t even be using the DNS add-on?

Just in case anyone else hasthe same problem and stumbles across this post, I did manage to fix the issue although I never discovered the cause.

To fix it, I:

  1. Created a snapshot in the “Hass.io > Snapshots” tab, downloaded to my host machine
  2. Stopped Virtualbox VM
  3. Created a new Virtualbox VM using the latest VMDK (original was created using 2.10 vmdk, new with 2.11 vmdk)
  4. Started new VM, installed Configurator, and uploaded snapshot to /backup using Configurator
  5. Updated the HassOS network config as described above to set a static IP and DNS
  6. Rebooted the VM
  7. Restored the snapshot, then rebooted the VM again

Networking all seems to work properly now, even after a host reboot.

I was having this issue previoulsy using ResinOS, and recently moved to Ubuntu and thought it was resolved, but its just happened again :frowning:

I dont know why its happening, the host can connect fine but the containers are struggling like this