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 ->

5 Answers 5


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 systemd-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
  • 1
    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. Apr 20, 2020 at 13:49
  • 3
    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 Jun 4, 2020 at 20:46
  • I think there's a typo restart systems-resolved Should that be restart systemd-resolved ?
    – Wyck
    May 17, 2021 at 16:09
  • 1
    The output of systemd-resolve --status wlan0 looks a bit different on systemd 248. It display +mDNS instead of Multicast DNS setting: yes to me. I assume they're equivalent May 30, 2021 at 6:24

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! Aug 2, 2018 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 Aug 2, 2018 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, 2018 at 4:25
  • 1
    Unfortunately it seems that it's currently unsupported with Netplan: bugs.launchpad.net/netplan/+bug/1830507
    – Pierz
    Sep 28, 2019 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, 2019 at 17:37

I spent a lot of time trying to get system-resolve working persistently after reboot, but couldn't get it to work to great frustration.

The steps I took as per instructions and comments above:

  • Set MulticastDNS=yes in /etc/systemd/resolved.conf
  • Created the file /etc/systemd/network/eth0.network with the following contents.


I tried following these instructions from the ArchLinux wiki using NetworkManager.

Nothing worked. So I finally decided to give up and go the systemd service route.

My solution

Update the multicast DNS (mDNS) settings for systemd-resolve, so that mDNS is enabled on the network link.

sudo nano /etc/systemd/resolved.conf

Update the following settings.


Create a service that runs after systemd-resolved.service runs, to enable mDNS on the eth0 network link. This will ensure that the multicast DNS is persisted across reboots.

sudo nano /etc/systemd/system/multicast-dns.service

Add the following.

Description=Enable MulticastDNS on eth0 network link

ExecStart=systemd-resolve --set-mdns=yes --interface=eth0


Enable the multicast-dns service.

sudo systemctl enable multicast-dns
sudo systemctl start multicast-dns
sudo systemctl status multicast-dns
sudo systemctl restart systemd-resolved

Let's test it.

# Protocols should show '+mDNS' instead of '-mDNS'
sudo systemd-resolve --status eth0
# The same information voor all network interface
resolvectl status
# Check if the hostname with .local added is resolved
resolvectl query `hostname`.local

Now reboot and system-resolve should be working out of the gate :-)

Hope this saves someone some frustration.

  • Thanks @nidkil. This worked for me in Ubuntu Server 20.04 inside VirtualBox (just had to use enp0s3 instead of eth0, which I found using ifconfig).
    – jeff-h
    Sep 27, 2021 at 21:30

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.


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

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.