mDNS (Multicast DNS)

(split out of this topic: Selecting a small office router - #16)

Interesting, I’ve not ever considered using mDNS, since the last router populated the local DNS with hostnames. However, I noticed that two of my Linux workstations running Arch Linux and using systemd-networkd to manage the network interfaces can find each other and communicate using IPv6:

[cbrake@ceres ~]$ ssh mars
Last login: Wed Jul 21 16:34:54 2021 from fe80::2d8:61ff:fefb:91be%eno1
[cbrake@mars ~]$ ssh ceres 
Last login: Wed Jul 21 16:36:14 2021 from fe80::922b:34ff:fe3f:64a6%enp39s0

It appears systemd-networkd supports mDNS, however, I’ve not figured out where that is configured as the default is not enabled.

However, a third Arch Linux machine running Networkmanager (it is a laptop, so I need to manage WiFi) does not seem to have mDNS enabled.

For now, I just did a DHCP reservation and set a static DNS entry for the machine that functions as a server.

I still might look into the DHCP->DNS script – it would be handy for all the embedded systems I work on to have local DNS entries. However, maybe we should start putting mDNS into our embedded Linux systems as this could be handy to have in the field – thoughts @khem?

mDNS is becoming more standard, even in MCU based devices. So mDNS might be handy in an IoT system for discovering other devices.

I installed Avahi and ran avahi-browse -at, and it only found my Brother printer – so still not quite sure what is going on with my Linux workstations that can find each other. Still need to get my Shelly devices back on the new WiFi network, and will then do some more experimenting.

Did a little more testing from a MAC, which I think has mDNS built in, and it can find BRN3C2AF4AB4265.local (the printer), but not the Linux workstations – so the Linux workstations finding each other must be some kind of IPv6 magic, not mDNS.

I’m not sure how your Arch setup works, but mDNS is great (and by default enabled on all Apple device since decades) both for finding a device by name or for finding devices which advertise specific services. You can use mDNS for DNS Service Discovery (http://www.dns-sd.org/) and this is super handy if you’re making networked products who need to be found or find things on the local network without asking the customer to configure them.

Adding a link here how to enable mDNS in systemd-networkd: Arch Linux notes - #10 by cbrake

As I continue to experiment with and Shelly IoT devices, I’m becoming more and more impressed how mDNS enables a great plug-n-play experience. One of the practical uses of mDNS for local devices is how easy it is to access them in a browser. If I type homeassistant in my browser, it will not try to connect to a local device unless I prefix with http://, jump through hoops, etc. However, if I type homeassistant.local, my browser knows I’m try to access a local device and just does the right thing.