Course contentsShow
← Linux
Lesson 621 of 1,8196. Systemd Internals and Unit OrchestrationFree lesson

Systemd-Resolved Configuration

Manage DNS resolution, search domains, and LLMNR configurations via systemd-resolved.

In this lesson, you will learn how to centralize your network’s DNS settings and local name resolution using systemd-resolved.

Understanding Systemd-Resolved

Traditionally, Linux systems relied on the /etc/resolv.conf file, which was often static and difficult to manage across different network environments. systemd-resolved acts as a local DNS stub listener, providing a modern, consistent interface for DNS resolution, LLMNR (Link-Local Multicast Name Resolution), and mDNS.

Configuring the Resolver

The primary configuration file for this service is /etc/systemd/resolved.conf. Inside this file, you can define your global DNS servers and search domains. If you want your system to resolve domain names using a specific set of public DNS servers (like those from Cloudflare or Google), you modify the [Resolve] section:

[Resolve]
DNS=8.8.8.8 8.8.4.4
Domains=yourdomain.local
LLMNR=yes
  • DNS: Specifies the IP addresses of the DNS servers to use.
  • Domains: Sets the search domain, allowing you to ping server1 instead of server1.yourdomain.local.
  • LLMNR: Enabling this allows your machine to resolve hostnames of other devices on the local network without a centralized DNS server.

Applying Changes

After editing the configuration, you must restart the service to apply the changes. Because systemd-resolved provides a stub listener, it typically binds to 127.0.0.53. You can verify that your settings are active by running:

resolvectl status

This command provides a comprehensive breakdown of which interface is using which DNS server, confirming that your configuration was parsed correctly. Unlike manual edits to /etc/resolv.conf, which are often overwritten by network managers, systemd-resolved manages the symlink to /etc/resolv.conf automatically, ensuring your custom settings persist across reboots and network state changes.

Key Takeaway: systemd-resolved provides a reliable, centralized way to manage DNS and local name resolution by serving as a local stub resolver, keeping your network configuration consistent and persistent.