Home assistant not using its own DNS

I’ve setup my new home assistant server, most things working but I’m getting fustrated with DNS.

At the moment I have the adguard DNS + DHCP server installed and running. Server IP is and the DNS is working. From a server on the network -

$ nslookup arm2

Non-authoritative answer:
Name:	arm2

However, home assistant itself isn’t using the DNS server. For example in the core-ssh terminal I see -

[core-ssh ~]$ nslookup arm2

*** Can't find arm2: No answer

Integrations such as -

  - platform: rest
    name: glances-arm2-system
    value_template: '{{ value_json.hr_name }}'
    resource: http://arm2:61208/api/3/system

fail since arm2 cannot be resolved.

I’ve configured the home assistant network to be static and with the DNS server -

How can I get home assistant to use its own DNS server ?



You have specified two DNS servers, and which one gets used is unpredictable - it doesn’t use the second one if the first can’t be contacted. Therefore if it chooses to use Google (, it will not be able to resolve “arm2”, so remove this one and try again.

Also, when you’re looking at core-ssh, that is a docker container, and is docker’s internal DNS server that just forwards requests to the DNS server on the host.

If you have a display connected to the HA machine (or have enabled SSH over port 22222) you can use the following commands to see the DNS on the host:

nmcli device status
nmcli device show <insert-interface-from-above-command>

Thanks, I didn’t know that. I assumed home assistant used the default for resolv.conf If there are multiple servers, the resolver library queries them in the order listed ( https://linux.die.net/man/5/resolv.conf ).

However I tried remove ( and rebooted ) but no change -

[core-ssh ~]$ host arm2
[core-ssh ~]$

I did noticed that core-ssh container can access the adguard dns server -

[core-ssh ~]$ host arm2
Using domain server:

arm2 has address
[core-ssh ~]$

I also noticed resolution via the default server,, is very slow ( 8 seconds ) -

[core-ssh ~]$ time host arm2
Using domain server:

real	0m8.043s
user	0m0.031s
sys	0m0.009s

But for public sites its fast -

[core-ssh ~]$ time host bbc.co.uk
Using domain server:

bbc.co.uk has address
bbc.co.uk has address
bbc.co.uk has address
bbc.co.uk has address
bbc.co.uk has IPv6 address 2a04:4e42:400::81
bbc.co.uk has IPv6 address 2a04:4e42:200::81
bbc.co.uk has IPv6 address 2a04:4e42::81
bbc.co.uk has IPv6 address 2a04:4e42:600::81
bbc.co.uk mail is handled by 20 cluster1a.eu.messagelabs.com.
bbc.co.uk mail is handled by 10 cluster1.eu.messagelabs.com.

real	0m0.144s
user	0m0.022s
sys	0m0.017s

I don’t have access right now, but I’ll try to get it.

Thanks for your reply.

Oh. From my other post ( where I found adguard applies a default domain of .lan ) I tried using that in core-ssh -

[core-ssh ~]$ host arm2.lan
arm2.lan has address

Using arm2.lan instead of arm2 in sensors also works. Yipee.

I’m still curious, though, why adguard dns can resolve arm2 but core-ssh can’t.

It’s because of the “search domain list”.

When you just write arm2, then the DNS client will look for a domain just called arm2, not a host.
When that fails then it looks in its search domain list for domains to search and then pretend arm2 on these an goes through the list one by one until it gets a successful reply.

Th search domain list can be distributed rom the echo server but DHCP clients do not always use this information.
With static IPs you have to configure the DHCP service to get this I formation specifically or you will have to set the list directly and manually.


Internally Home Assistent uses a search domain of local.hass.io … maybe it could include lan as well.

I found Adguard Home supports Automatic hosts ( DHCP · AdguardTeam/AdGuardHome Wiki · GitHub ) - DHCP hosts are included in DNS but in the default .lan domain. I didn’t find this info in the Home Assistant docs.

But neither changing the domain nor the DHCP search domain ( option 119 ) is exposed via the Home Assistant Adguard plugin. So clients have to use .lan at the moment … still thats much better than IP addresses !

Enhancement tracked in local_domain_name support · Issue #410 · hassio-addons/addon-adguard-home · GitHub

I think I had a workaround for that problems once, where I used the router DHCP and DNS, but made sure the router itself used the HA addons to look up things and then the HA addons access the internet for further lookups.
This opened up the routers possibilities, but made sure the HA addons’ features were still usable too.