HA OS does not resolve .local hostnames(Solved)

Hello.
My HaOS doesn’t even try to resolve .local hostnames.
I read the thread. But it seems that what it says is not true, at least in my situation.

My HaOS instance is running in VM on my server.
I am trying to resolve names and at the same time using tcpdump to see what dns requests are coming out of the VM.

When i’m trying to resolve hostname X.local inside HA, no dns requests generating by VM. But if I try to resolve any other name, even “X.local1” - everything works as it should:

12:26:58.647054 IP ha.local.47516 > gw.local.domain: 58518+ [1au] A? np.local1. (38)
12:26:58.647232 IP gw.local.domain > ha.local.47516: 58518 NXDomain 0/6/1 (1030)

There seems to be something inside HaOS that prevents the .local names from working properly. How do I fix it?

UPD:
Figured out that haos only tries to resolve local names through mdns:

12:43:02.476468 IP ha.local.mdns > 224.0.0.251.mdns: 0 A (QM)? np.local. (26)
12:43:02.476676 IP6 fe80::63c:71c9:cf2b:2169.mdns > ff02::fb.mdns: 0 AAAA (QM)? np.local. (26)
12:43:03.583359 IP ha.local.mdns > 224.0.0.251.mdns: 0 A (QM)? np.local. (26)
12:43:03.583488 IP6 fe80::63c:71c9:cf2b:2169.mdns > ff02::fb.mdns: 0 AAAA (QM)? np.local. (26)

Yeah, you should not be using .local for local hosts for this reason. I’ve tried a bunch and finally settled on using .home.arpa as that seems the have the best support and prevents leakage of dns queries to upstream dns servers.

I want to use .local names. And I think it is wrong for the software to dictate to me what to use :slight_smile:

I seem to have found a way to fix this via systemd-resolved, but it’s “os hack”. I would like to find a more traditional way)

Well you can’t use that if you want it to work without mDNS

Why i can’t? I will disable mDNS in haos and .local will work as regular domains.

I fixed it by rewriting /etc/resolv.conf in root filesystem image.
But I guess this will have to be repeated for every HaOS update.

  OS Version:               Home Assistant OS 10.1
  Home Assistant Core:      2023.5.2

  Home Assistant URL:       http://ha.local:8123
  Observer URL:             http://ha.local:4357
[core-ssh ~]$ ping macbook.local
PING macbook.local (192.168.1.64): 56 data bytes
64 bytes from 192.168.1.64: seq=0 ttl=63 time=1.460 ms
64 bytes from 192.168.1.64: seq=1 ttl=63 time=2.011 ms

Found brillaint solition.
I switched network in HaOS to dhcp mode (automatic).
And configured my dhcp server to export “local” in search domains.

option domain-name "local";

Local domains now works without hacks and without having to fix it after the upgrade!

:tada:

how does one do this on a unifi system? any idea?

What do you mean by unifi system? I have unifi controller launched as a regular application on my server. They have VM images like HaOS?

I found a solution for this problem. Don’t use Static IP addres for HA, set it to Automatic

As an FYI, I have two HA systems running HAOS 10.5, both running in a QEMU/KVM setup, using static IPs, and from either HAOS root shell or inside the homeassistant docker bash shell I can successfully ping devices across my LAN using xxx.local. Best I recall, I did not have to do anything special to get this to work.