So just to clarify, the fallback isn’t involved in mdns queries. On a system with supervisor, here’s a rough overview of what happens:
- When you do
ha dns info
, the host system knows about the DNS server(s) listed inlocals
. The ones listed inservers
are not known to it, plugin-dns/coredns handles those. - When a query that ends in
.local
or a single-label name comes in to plugin-dns, it does not attempt to resolve it on its own. Instead it simply asks the host’s systemd-resolved for an answer over dbus. Keep in mind the host knowsmdns
,llmnr
and the dns servers listed inlocals
. It can use any and all of this information in answering queries (though it may choose not to, we have no control over it) - Plugin-dns returns whatever answer is provided by systemd-resolved in this case. It does not ask any other dns servers or answers regardless of the status code. Not the ones in
servers
, notfallback
, nothing else is queried.
What your suggesting is actually pretty complex. I mean you’re asking for all the options required to configure a domain with totally separate handling from everything else. And even if we did that we probably wouldn’t allow .local
since according to the spec we shouldn’t. The authority for .local on a network is mdns. I think if you need this much control over the network then tbh you would probably be better served with a container install then one with supervisor.
One thing that I suppose we could do here is an option to simply disable mdns/llmnr. So it would look kind of like this:
- Add a new option for “disable multicast dns” to supervisor’s DNS API
- Supervisor writes this option into config file for dns plugin
- DNS plugin omits this line based on this new option. Then no special treatment for MDNS and LLMNR queries is given.
- Update the CLI to support this new option
- Update API doc for this new option
In addition there would also need to be a check to mark the system as unsupported for usage of this setting in supervisor. There are definitely a bunch of dependencies on mdns that may break with this setting such as:
- ESPHome devices broadcast their name using mdns by default
- Home Assistant broadcasts its name via mdns and llmnr
- MDNS discovery enabled by default in HA
- Local Google Assistant relies on mdns (not sure if this would break or not)
This is a shortlist off the top of my head. Basically either the setting would simply mark a system as unsupported or an author would need to research all the combinations of things with that setting which would break and mark those combinations as unsupported. Since we don’t want issues caused by folks disabling mdns while also enabling features that rely on mdns.
If you or someone wants to PR this then I think that could work. I can add it to my list but tbh there’s a lot on there already unrelated to DNS so I’m not sure when I’ll get to it. That and I’m not 100% convinced we should be doing it. If you scan this thread and the others around local DNS issues you’ll see a common refrain is “Why is Home Assistant doing its own DNS and not just asking the host system?” Well .local
is now a case where that’s exactly what we are doing. We’re not doing our own DNS and simply asking the host system. Seems very counterintuitive to remove that.