Home Assistant in VM unable to resolve .local

rroumen

Cadet
Joined
May 6, 2022
Messages
2
Hi,

Just migrated my Proxmox stuff to TrueNAS Scale and really satisfied. Last challenge I ran into was that my Home Assistant using ESPHome was unable to resolve .local hosts to their IP addresses. This is for example used by the ESPHome plugin if you don't want to assign all fixed IP to your devices.

After some digging I found that also in TrueNAS shell I was unable to ping xxxx.local and the cause was found in the /etc/nsswitch.conf file which did not contain an mdns entry in the hosts: section.

This is what my /etc/nsswitch.conf looked like:
Code:
#
# nsswitch.conf(5) - name service switch configuration file
#

group: files winbind ldap
hosts: files dns mymachines
networks: files
passwd: files winbind ldap
shells: files
services: files
protocols: files
rpc: files
sudoers: files


I changed the hosts: line to:
Code:
hosts: files dns mymachines mdns4_minimal [NOTFOUND=return]


And all is working great now.

Kind regards, Roger.
 

avvd

Cadet
Joined
May 28, 2022
Messages
5
I'm experiencing the same issue when moving from proxmox to Truenas scale. At the first the resolving also didn't work in the truenas host. After enableding the setting above it did work. However, within the virtual machines where homeassistant is running with the ESPhome addin the mdns is not yet working. I tried the direct network interface and the virtio network interface, anyone have an idea what I'm missing or what I can check?
 

avvd

Cadet
Joined
May 28, 2022
Messages
5
A small addition to the post above, forgot to mention, I also loaded an ubuntu vm in truenas but there resolving .local domains also doesn't work. The same vm on a proxmox system does work. So it seems truenas has difficulties to passtrough the mDNS traffic true the virtual machines.
 

avvd

Cadet
Joined
May 28, 2022
Messages
5
It is fixed, here is the solution:

I needed to added a bridge interface to make it work. Adding the bridge wasn't strait forward. Using the guides is caused some issues as the bridge interface didn't came up. So I added a different subnet to the main interface and the right subnet to the bridge interface. The bridge didn't came up until I rebooted Truenas (I found some other discussions in this forum where was discussed if it was a bug or a feature).

After the reboot the bridge automatically came up and I was able to delete the second subnet and IP from the main interface. Now the mdns is working in the vm's.
 

avvd

Cadet
Joined
May 28, 2022
Messages
5
After setting the Bridge interface to the 'main' ip adress and a second subnet (which I don't use) to the nic itself it is working, the vm's can also see the mdns broadcasts
 

avvd

Cadet
Joined
May 28, 2022
Messages
5
See screenshot, the 192.168.0.0/24 network is the network I use, the br0 interface is linked to the vm's.
 

Attachments

  • Screenshot_20220528-235743_Chrome.jpg
    Screenshot_20220528-235743_Chrome.jpg
    133.7 KB · Views: 453

Mixel

Explorer
Joined
Jan 11, 2014
Messages
50
Would you be willing to elaborate a bit more on the steps you took to create the bridge to vlan of vms? I cant seem to gets it right.
 
Top