Fancy routers? What does that constitute?
Purely for clarification.
I meant that I have a boring domestic home router, nothing advanced that lets me configure DNS records. I mentioned it because I was looking to enable whatever the automatic “the host broadcasts or responds itself” - and not have someone tell me to add DNS entries in my DNS server.
Thanks for the suggestion to look at systemd-resolved
. That was very simple to get going, and didn’t require that I install anything like Avahi. Here is what worked for me.
First, use systemctl status
to confirm that you are using systemd-resolved
, and check with systemd-resolve --status
to see the current status of mDNS
. Here is an example fragment of the output. The -mDNS
piece means that mDNS
is disabled:
Link 2 (eno1)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.4.1
DNS Servers: 192.168.4.1
Default Route: yes
Confirm that your host has a hostname configured:
$ hostnamectl hostname
box
Create or edit the file /etc/systemd/resolved.conf
, ensure this is present:
[Resolve]
MulticastDNS=true
Restart systemd-resolved
:
sudo systemctl restart systemd-resolved
The systemd-resolve --status
command should now show +mDNS
. Example:
Link 2 (eno1)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
Protocols: +DefaultRoute LLMNR=resolve +mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Servers: 192.168.4.1
Default Route: yes
Confirm via another machine on the network (previously this was failing to resolve!):
> ping box.local
PING box.local (192.168.5.31): 56 data bytes
64 bytes from 192.168.5.31: seq=0 ttl=64 time=5.742 ms
64 bytes from 192.168.5.31: seq=1 ttl=64 time=4.953 ms
64 bytes from 192.168.5.31: seq=2 ttl=64 time=5.849 ms
Done!
Some documentation I found stated that MulticastDNS
would need to be enabled not just at this “global” level, but at the “per-link” level too. I did not find that to be true - the global setting was enough in my case.