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

6 Answers 6


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. Commented 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 Commented Jun 4, 2020 at 20:46
  • I think there's a typo restart systems-resolved Should that be restart systemd-resolved ?
    – Wyck
    Commented 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 Commented May 30, 2021 at 6:24
  • 4
    For Ubuntu 22.04, use resolvectl mdns <interface> yes in place of systemd-resolve.
    – Zeyi Fan
    Commented Jun 4, 2022 at 4:48

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! Commented Aug 2, 2018 at 3:47
  • 5
    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 Commented 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
    Commented Aug 2, 2018 at 4:25
  • 1
    Unfortunately it seems that it's currently unsupported with Netplan: bugs.launchpad.net/netplan/+bug/1830507
    – Pierz
    Commented 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
    Commented 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
    Commented Sep 27, 2021 at 21:30
  • @nidkil Check my answer below unix.stackexchange.com/a/763471/482816 as I suspect you have network manager installed also. Commented Dec 10, 2023 at 6:28

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
  • Avahi doesn't play nice with aliased network interfaces though. For example it is impossible to configure two separate hosts (and respective services) for two different IPs on the same network interface. This makes Avahi unsuitable for publishing services of nodes on an isolated subnet via NAT.
    – Coder Guy
    Commented Apr 21, 2023 at 20:16

I tried solving this problem several times over the years but always resorted to using avahi...

However I discovered in the Ubuntu documentation https://ubuntu.com/core/docs/networkmanager it says:

However, when NetworkManager is installed, it will take control of all networking devices in the system by creating a netplan configuration file in which it sets itself as the default network renderer.

This worked for me on Ubuntu 20.04.6:

  1. Check if network-manager is installed: apt list --installed | grep network-manager. Proceed if it is else try the pure systemd solutions provided in others answers.
  2. Get the name of the device that you want to enable mDNS on by running either ifconfig or ip link show. Take note of this name for the last step but often the name is eth0 (some of my machines had enp0s25 for some reason).
  3. Disable avahi if you have it installed (or remove it): sudo systemctl disable avahi-daemon or sudo apt remove avahi-daemon
  4. Edit resolved.conf (like others have described above) sudo nano /etc/systemd/resolved.conf and uncomment and set MulticastDNS=yes
  5. Show the network connections nmcli connection show and look at the "Name" column and note the name of the connection you want to edit. On my machine it is Wired connection 1.
  6. Toggle on mDNS on this connection using this name (note wrap the name in double quotes to handle spaces) sudo nmcli connection modify "Wired connection 1" connection.mdns yes
  7. reboot sudo shutdown -r now
  8. verify the device name now has MulticastDNS/mDNS enabled sudo systemd-resolve --status eth0

Link 2 (eth0) Current Scopes: DNS mDNS/IPv4 mDNS/IPv6 DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: yes <----- yay!
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server:
DNS Servers:
DNS Domain: ~.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .