Yes home assistant can use itself for DNS. This is because DNS uses a client server model. The DNS Server software uses port 53 and the DNS Client software uses any random port above 1023. Whenever the client needs to resolve a DNS name it picks a random port then sends the message to port 53. Then the server software responds and sends the resonse back to whatever port the client opened. I use windows as my DNS but it works the same way. As you can see from the photo I have both running at the same time.
I know a system can use itself for DNS. Have done this plenty of times in the past.
I can’t seem to get it working in Home Assistant OS though. Setting the DNS server to the internal IP (or to 127.0.0.1) results in no domain name resolution.
DNS continues to work for external clients. It’s very odd…
Have revisited after your suggestion, and it appears there’s just a long delay before it returns a result, not an issue I’ve experienced with other clients.
Weirdly, it’s not returning the internal IP for my duckdns address, mapped in DNSMasq. No idea why. Works when queried from another client.
HA needs to have a working DNS, so there is a hardcoded fallback DNS in the code.
When the entire host starts up, then the DNS might not started up for when HA needs it, so it uses the fallback and it might take some time for it to realize that the original DNS service is online and it can revert to it.
Older versions of HA also had a bug that often prevented it to revert, so make sure you are running a newer version of HA.
Firstly, thanks for the link @WallyR . Hadn’t seen that.
Unfortunately, disabling the fallback didn’t change the result. Not what I was expecting.
I hadn’t considered that it might be DNSMasq causing the issue, so I just installed Adguard, had it listen on all available addresses, and it works perfectly!
Next guess is that DNSMasq isn’t listening on the right address to facilitate DNS requests from HA/Localhost?