Running Home Assistant in docker - DNS

Running Home Assistant in docker on a debian host.
I’m getting a strange issue with DNS.

From my understanding, the home assistant gets it’s DNS information from this file;
/usr/share/hassio/dns/corefile

When looking in this file, I see 4 DNS entries

.:53 {
    log
    hosts /config/hosts {
        fallthrough
    }
    forward . dns://<localip> dns://<localip> dns://8.8.8.8 dns://1.1.1.1 {
        health_check 10s
    }
}

Normally this wouldn’t be a problem, but it appears that Home Assistant does a ‘round robbin’ approach and makes use of the google DNS servers. (this is bad because I have devices that are only resolvable locally)

When I remove the google DNS servers from that config file, they are regenerated upon reboot.

how is this corefile created? and what is writing to it? and how can I stop 8.8.8.8 and 1.1.1.1 being amended to this file?

Are you running Home Assistant in docker or Hassio in docker? If you are running Hassio there are multiple other threads on this problem.

I am just asking because I run just Home Assistant in docker, and not Hassio and would like to know before I try to upgrade my docker container…

Just checked, im running hassio in docker.

Hi Nato,
I had the same problem, after about 24h i found the solution!
Somehow there now is a file in /usr/share/hassio called dns.json. this file deterimes the dns servers, if you change it there and reboot it will work :slight_smile:
Greetz, Jerry :v:

Hi Jerzeek,
I tried your suggestion and modified dns.json to the following;

{
  "servers": [
    "dns://10.5.1.4",
    "dns://10.5.1.5"
  ],
  "version": "1"
}

However, after a reboot my /usr/share/hassio/dns/corefile is still showing;

.:53 {
    log
    hosts /config/hosts {
        fallthrough
    }
    forward . dns://10.5.1.4 dns://10.5.1.5 dns://8.8.8.8 dns://1.1.1.1 {
        health_check 10s
    }
}

It must be pulling those additional DNS servers from somewhere else. :frowning:

Yeah I had the same, but since my personal dns was first it was working. let me know if you find a better solution. Also I dont know why it broke overnight, do you?

There are a lot of threads about these recent dns issues. It’s a known bug and is being worked on.

Because the hassio-supervisor was automatically updated in the last 24 hours.

Found the reported bug if anyone is interested.

https://github.com/home-assistant/hassio/pull/1238

That file is persistent across reboots (hass.io/docker/debian) for me.