Ubuntu 18

I've done a ton of research and am close to pulling this picture together but can't quite understand:

How can I configure systemd-resolved for mdns?

My goal specifically:

  • to bring up a server on a network
  • for the new server to give itself some arbitrary name like foo1
  • to be able to connect to that server from another machine on the same network using the name foo1

Can anyone tell me please how to make this happen specifically using systemd-resolved?


So far I have configured resolved.conf at follows on

ubuntu@ip-10-0-0-229:/etc$ --> CHROME -> cat /etc/systemd/resolved.conf
#  This file is part of systemd.
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
# See resolved.conf(5) for details

ubuntu@ip-10-0-0-229:/etc$ --> CHROME ->
  • 1
    Sad... it is 2019 and this is still a mess... – user56041 Feb 14 '19 at 13:52

This is a late answer but I still think that can help someone because there are few infos on this topic. I also wasted time on this problem.

Changing the /etc/systemd/resolved.conf is just a part of the work. After your changed it you still need to resolve this puzzle:

Multicast DNS will be enabled on a link only if the per-link and the global setting is on.

And if you know the trick... it's easy.

sudo systemd-resolve --set-mdns=yes --interface=wlan0

wlan0 is the interface where the mDNS is requested. After that, you can see that mDNS is activated:

$ sudo systemd-resolve --status wlan0            
Link 3 (wlan0)
      Current Scopes: none
 DefaultRoute setting: no
        LLMNR setting: yes
 MulticastDNS setting: yes #<--- BINGO! 
   DNSOverTLS setting: no
       DNSSEC setting: allow-downgrade
       DNSSEC supported: yes

Restart systemd-resolved via systemctl:

$ sudo systemctl restart systems-resolved 

And mDNS is working!


~ ❯ ping homebridge.local                                    
ping: cannot resolve homebridge.local: Unknown host


~ ❯ ping homebridge.local                                    
PING homebridge.local ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=21.721 ms
64 bytes from icmp_seq=1 ttl=64 time=22.429 ms
  • And the reason that we need to do this is because systemd as implemented by the distro vendors broke existing behavior. The reader would do well to check the new ---ntpd--- systemd-timesyncd configuration because SystemD is All. SystemD Is The Way. – Andrew Beals Apr 20 '20 at 13:49
  • 1
    same can be achieved with adding MulticastDNS=yes to the interface config file. For example for eth0, you can add it to /etc/systemd/network/eth.network. Otherwise, the steps you give don't persist across reboot – novelistparty Jun 4 '20 at 20:46

In order to enable mDNS on an interface, you need to set the MulticastDNS= option in the [Network] section of the .network file for the interface in the network.

This option defaults to disabled and needs to be enabled per interface.

You can also use the systemd-resolve --status command (available on systemd v237 shipped in Ubuntu 18.04, newer systemd replaced this command with resolvectl) to query the status of resolved, including options enabled for each network interface. If you see MulticastDNS setting: no for the Link interface where the network, then that means it's not enabled yet.

  • 1
    The network device is eth0 and there appears to be no .network files in the /etc directory anywhere. It appears that Ubuntu 18 is configured via /etc/netplan/50-cloud-init.yaml can you suggest where I should set the MulticastDNS= option in this setup? thanks! – Duke Dougal Aug 2 '18 at 3:47
  • 4
    I created /etc/systemd/network/eth0.network, containing: [Match] Name=eth0 [Network] MuticastDNS=yes but no luck after restarting networking with sudo systemctl restart systemd-networkd – Duke Dougal Aug 2 '18 at 4:02
  • Ugh netplan... I believe netplan will generate .network config files under /run/systemd/network, maybe take a look there and see what it's generating. I also think it's quite possible it doesn't support MulticastDNS= natively. If you do find which file it creates for eth0, then try systemctl edit eth0.network (assuming that's the file name), which will create a "drop-in" (assuming .network works with drop-ins?) where you can try to add the [Network] MuticastDNS=yes... Hopefully that helps? – filbranden Aug 2 '18 at 4:25
  • 1
    Unfortunately it seems that it's currently unsupported with Netplan: bugs.launchpad.net/netplan/+bug/1830507 – Pierz Sep 28 '19 at 17:24
  • @Pierz See my comment above, about using an additional drop-in file to add to the netplan generated configs. – filbranden Sep 28 '19 at 17:37

My way of dealing with mDNS (avahi) is this

• sudo apt install ifupdown
• sudo apt install avahi-utils

idea from text in

• cat /etc/network/interfaces 
• # ifupdown has been replaced by netplan(5) on this system.  See
• # /etc/netplan for current configuration.
• # To re-enable ifupdown on this system, you can run:
• # sudo apt install ifupdown

In addition to MulticastDNS=yes in your .network file, the same setting also needs to be set in resolved.conf. From resolved.conf doc:

Multicast DNS will be enabled on a link only if the per-link and the global setting is on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.