DNS Resolution for .local or .lan TLD

I would like to use local domain names for my network devices instead of IP address in HA configuration.

My AdGuard installation (as addon on HA OS) has been set up properly and AdGuard is able to resolve host names as

mydevice.mydomain.lan

but it seems that HA core never query AdGuard for host names as this one. The same happens for host names ending with .local.

Any other query with different TLD reach my AdGuard, for example

mydevice.lan.mydomain.something.

There is a reason for this? Is something that can be changed?

By the way, what is the best/proper setting to ensure HA core and all addons under HA OS use AdGuard addon as DNS?

IN the Settings > System > Network menu set your DNS server to be AdGuard.

yes, but what IP address?

The IP address of the machine running adguard. Which is the current machine in this case. So put its LAN IP in DNS server.

I read somewhere on the boards that HA have a fallback for DNS and there is a bug in this feature, so it does never reset once activated.
AdGuard would probably fail the first few attempts since it is an add-on that is running on HA and therefore it might activate this bugged feature.

This isn’t true anymore. It only goes to the fallback if the DNS server provided via DHCP or in static config and any other added DNS servers fail to return an answer.

That’s what I did. I used the LAN IP address of the raspberry pi, the same IP other computers of the LAN use as DNS server, say 192.168.1.2.

AdGuard addon receive and answer DNS queries from computers and HA, except queries for .lan or .local from HA core and addon.

Why?

.local seems to be controlled by another name lookup service, maybe mDNS and the priority of the name lookup service and how they interact can be the reason for the .local issues.
I do not know if .lan is also controlled by other services.

It’s not. There’s a list of special use TLDs, you can find that list here. .local is one, .lan is not.

In addition I should note that single name hostnames without a TLD (like homeassistant or my-pc for example) are expected to be resolved via LLMNR. Or via a hosts file lookup on a local machine. They are also not expected to go to a DNS resolver either.

I remember there was a proposal to reserve a few TLDs for LAN-only use like .lan, .internal, .home, etc. I’m failing to find it now. But anything other then those ones wikipedia lists as special-use work normally (all systems including HA ask the configured DNS server for an answer).

I use .lan personally. I’ve also used .home in the past and seen others use .home.arpa around here. Can kind of take your pick from any that aren’t reserved for special use like .local.

Thanks for the reply, Mike
Do you know how AdGuard react to the use of the reserved domains?

I can confirm that DNS query like nslookup myhost.mydomain.lan are still not resolved under HA OS with error NXDOMAIN, despite my custom rules in AdGuard. No entry about these queries appear in AdGuard log.

What does ha dns info say?

image

I assume 192.168.1.2 is the IP of the ha machine, if so that makes sense. Any issues in ha resolution info? Also just to check, if you do nslookup myhost.mydomain.lan 192.168.1.2 and specifically query the machine running Adguard you get the answer you want right?

Yes, 192.168.1.2 is the ip address of my raspberry pi with HA OS and AdGuard addon. There is something special with the .lan TLD in HA OS. In other OS (e.g. Windows on other machines) or with other TLD is fine.

There isn’t. I also run Adguard.

That being said I am noticing that I actually can’t get homeassistant.lan to resolve from anywhere in my network which is odd. I don’t really use that one since I have a different internal url for HA with an SSL cert. Kind of odd since it should work, maybe something strange with that one.

The resolution issue is not only for homeassistant.lan and is only in HA OS, not in other machines.
Tried to define my hosts in AdGuard both in DNS rewrite and custom rules.

image

Ok I mean I’m not really sure how to explain what you’re seeing. I’m actually mdegat01 on GitHub. If you look at supervisors DNS plugin you’ll see most of the recent commits are by me. You’re welcome to review the code but I can assure you there’s nothing in there about .lan. And in addition im showing you .lan queries working on my HAOS system.

So I can help you debug but there is no special handling around .lan in an HAOS system. There is something going on in your setup.

Well I mean Adguard will let you make a DNS rewrite rule for basically anything you want. But the challenging part is will machines actually send those queries to it? HAOS for example won’t send .local queries to Adguard or any other resolver. Neither will any Linux system that relies on systemd-resolved. But other systems and resolvers might.

I believe you. But at this point there shoud be something on my system that prevent DNS queries for .lan domain from passing from HA to AdGuard addon…