Timeout while contacting DNS servers

FYI: Forcing DNS to 8.8.8.8 (via docker compose’s dns attribute) immediately fixed it for me.

I am not sure if mine was the same cause as others, but it turns out my Pihole was lowkey getting DOSed by my usual traffic - too many queries per second so it was dropping some. I reduced the queries (by switching things like Loki and Zabbix to IP not domain name) and it resolved the timeouts in logs I was seeing.

I know it’s been a few months, but I’ve been having this issue for many months as well and haven’t been able to find the source of the problem.

I run HA on docker on a Proxmox LXC
I have two copies of pihole running, one as a primary and one for failover/backup, both in LXCs but not in docker.

All of my timeouts are obtaining local IP addresses for home network components, so adding 8.8.8.8 will do nothing for me.

Looking in pihole I see HA talking to both of my DNS servers, so it obviously has timeouts on one of them and fails over to the next…perhaps the drop outs I’m getting is when it periodically fails getting a reply from that second server as well.

I’ve written all sorts of monitoring tools on many machines to see if they see any lack of DNS resolution, and none of them seem to experience the problem, I get zero dropouts from any other services or applications on the network, only from HA.

I mostly see the issue on rest APIs to a local invtertor on my network, and when calling uptimerobot APIs. Though I am not sure that last one is DNS or not.

My logs can be filled with the following message sometimes.

Error fetching data: http://xxxxx.xxxxx.xx/ failed with Cannot connect to host xxxxx.xxxxx.xx:80 ssl:default [Timeout while contacting DNS servers]

I’m experiencing the same issue for a few months now. Running HA on HAOS.

I’ve tried my router’s DNS, my own AdGuard, 8.8.8.8, nothing helps.

Sharing that this proposed fix worked perfectly for the “Timeout while contacting DNS servers” error that I had been getting, which I noticed while trying to use HACS to download or update plugins. So thanks for that!

Here’s my setup:

  • Home Assistant (Docker) Container
  • Core version: 2025.12.3
  • Python: 3.13.9
  • OS: Debian GNU/Linux 11 (bullseye)
  • Architecture: aarch64
  • Pi-hole + Tailscale also installed

What I had noticed was that in my Home Assistant container the file /etc/resolv.conf looked like this:

# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.

nameserver 100.100.100.100
search <tailscale-magic-dns>.ts.net

# Based on host file: '/etc/resolv.conf'
# Overrides: []

I’m running HA with host networking, therefore if I understand it correctly using the Docker dns: options wouldn’t fix my problem; so, since I won’t be needing Tailscale’s Magic DNS feature in Home Assistant, I created a custom resolv.conf file:

sudo mkdir -p /opt/ha-dns
sudo vi /opt/ha-dns/resolv.conf

With this content:

nameserver 127.0.0.1    # Pi-hole
options timeout:1 attempts:3

I edited my Home Assistant Docker compose file in order to add the mount of a custom resolv.conf file:

    volumes:
    ...
    - /opt/ha-dns/resolv.conf:/etc/resolv.conf:ro

And restarted the container.

After HA was once again online, I verified in Pi-hole that queries using DNS (such as a reload of the HACS integration) were showing up correctly, e.g.:

And the “Timeout while contacting DNS servers” error disappeared; therefore, I am once again able to use HACS.

Those don’t fix the issue i have.
I use Docker container name to point to other services that are HAss integrations.
HAss used to be able to reach them through the container name.
HAss can’t reach them through the container name now.
Using an external resolver doesn’t fix the issue, as the external resolver doesn’t have the container names.
I therefore assigned static IPs to my containers and declared the IPs instead of the names.

This problem has been going on since 25.5 here too but I have sort of lived with it filling the log book on a daily basis. Mostly the system does seem to work, but a couple of more intensive integrations do suffer. Energy Consumption and HVAC specifically.

Can any of the solutions be employed on a native HAOS hass instance like I am running? I can’t really get access to some of the files mentioned ( or I don’t yet know how to do so ).

I also can’t understand why this is not a CORE DEV BUG which is urgently worked and resolved? DNS is so fundamental. Is it something specific with all the users posting in this topic then? [Just speculating].

I also can’t understand why this is not a CORE DEV BUG which is urgently worked and resolved?

I raised the issue on Github back in May, but that is no guarantee that the devs will look at it.

Ok - I created another more lengthy bug I expect they are related.

I am getting these too - noticed it since 2026.2 for some reason. And it effects almost all plugins requesting external data.
Commented to @Toness Github issue to bring this to attention? ;-).
By the way, i am running my HA on a Pi4 at HAOS.

I’ve used the site a few times to compare latency and reliability, and it helped me figure out which servers were actually stable over weeks, not just on paper. If you’re checking options in the US, the usa dns server list made it easy to spot high‑trust picks with solid uptime, so I didn’t have to trial-and-error everything myself.