Linux systemd-resolved: Not Answering Multicast DNS
If you're like me, you've replaced the traditional networking stack in your Linux system with systemd and its components, such as NetworkManager, dnsmasq, dhcpcd, and avahi-daemon. While things generally work well, you might have encountered an issue where systemd-resolved fails to answer Multicast DNS (mDNS) queries.
Understanding the Components
Before diving into the issue, let's briefly discuss the components involved:
systemd-resolved: A system resolver and network name service manager.- mDNS: A zero-configuration networking protocol for discovering devices on a local network.
- Avahi: A free, open-source implementation of mDNS and DNS-SD (DNS Service Discovery) for Linux and Unix systems.
The Problem
After replacing the traditional networking stack with systemd and its components, you might notice that systemd-resolved doesn't answer mDNS queries. Devices on the local network might not be discoverable, or services might not be resolvable.
The Solution
The solution is to re-enable the Avahi daemon and configure systemd-resolved to use it as the mDNS resolver.
Step 1: Re-enable Avahi
To re-enable Avahi, install the avahi-daemon package if it's not already installed:
sudo apt-get install avahi-daemon
Then, ensure that the Avahi daemon starts automatically on boot:
sudo systemctl enable avahi-daemon.service
Step 2: Configure systemd-resolved
Next, configure systemd-resolved to use Avahi as the mDNS resolver:
- Create a new file,
/etc/systemd/resolved.conf.d/avahi.conf, with the following content:
[Resolve]
MulticastDNS=resolve
This configuration tells systemd-resolved to use Avahi for mDNS resolution.
- Reload the
systemd-resolvedconfiguration:
sudo systemctl restart systemd-resolved
Testing the Solution
To test the solution, use tools like avahi-browse or avahi-discover to ensure that devices and services on the local network are discoverable.
In this article, we discussed the issue of systemd-resolved not answering mDNS queries after replacing the traditional networking stack with systemd and its components. We provided a solution by re-enabling the Avahi daemon and configuring systemd-resolved to use Avahi as the mDNS resolver.