systemd-resolved is the system service for network name resolution that ships with systemd and is enabled by default on Ubuntu, Fedora and many other distributions. In Linux networking it acts as a local caching stub resolver: applications send their lookups to it, and it forwards them to the right upstream DNS servers, validates and caches the answers and returns them.
Beyond classic unicast DNS, the service also handles LLMNR and multicast DNS, optional DNSSEC validation and DNS over TLS. Its most important feature for administrators is per-link DNS configuration, which allows different interfaces, such as a VPN tunnel and a home Wi-Fi link, to use different DNS servers for different domains.
How systemd-resolved resolves names
systemd-resolved receives queries through three interfaces and answers all of them from the same cache and configuration. Native clients use the D-Bus API or the nss-resolve module in /etc/nsswitch.conf, while legacy software that reads resolv.conf talks to a stub listener on 127.0.0.53, port 53.
When a query arrives, the service selects the most specific matching link based on its routing domains, sends the query to that link’s servers and stores the answer in a positive and negative cache that respects record TTLs. Since systemd 253 a second listener on 127.0.0.54 runs in proxy mode, passing queries upstream without the local synthesis and LLMNR logic.
The table below summarizes the ways a program can reach the service and what each path provides.
| Interface | Used by | Capabilities |
|---|---|---|
| D-Bus API | resolvectl, NetworkManager | Full feature set, per-link data |
| nss-resolve | glibc getaddrinfo callers | Full routing, no DNS packet parsing |
| Stub on 127.0.0.53 | Programs reading resolv.conf | Standard DNS, caching, split DNS |
| Proxy on 127.0.0.54 | Tools needing raw upstream answers | Forwarding without local synthesis |
Per-link DNS and routing domains
Per-link configuration is what makes systemd-resolved more than a cache: every network interface carries its own DNS servers and domains. NetworkManager, systemd-networkd or a VPN client pushes these values through D-Bus, and resolvectl status shows them per link.
Domains come in two kinds. A search domain is appended to single-label names and also routes queries, while a routing-only domain, written with a tilde such as ~corp.example, only steers matching queries to that link. The special entry ~. makes a link the default route for all queries, which is how full-tunnel VPNs prevent DNS leaks.
| Link setting | Query for host.corp.example | Query for example.org |
|---|---|---|
| VPN with ~corp.example | Sent to VPN DNS servers | Sent to default links |
| VPN with ~. | Sent to VPN DNS servers | Sent to VPN DNS servers |
| No domains on VPN | Sent to all default-route links | Sent to all default-route links |
| VPN with DefaultRoute=no | Only if a domain matches | Never sent to VPN |
This split DNS model solves a long-standing problem: with a single resolv.conf, the last tool to write the file wins, and corporate names or private zones can silently resolve through the wrong servers.
Configuration and the resolv.conf modes
Global settings live in /etc/systemd/resolved.conf and drop-in files under resolved.conf.d, while per-link settings usually come from the network manager. Key options include DNS=, FallbackDNS=, Domains=, DNSSEC=, DNSOverTLS=, MulticastDNS=, LLMNR=, Cache= and DNSStubListener=.
How /etc/resolv.conf is handled determines whether legacy programs benefit from the service. systemd-resolved supports four integration modes, and the recommended one is a symbolic link to the stub file.
| resolv.conf points to | Content | Result |
|---|---|---|
| /run/systemd/resolve/stub-resolv.conf | nameserver 127.0.0.53 plus search domains | Recommended, full split DNS |
| /run/systemd/resolve/resolv.conf | Real upstream servers | Bypasses cache and routing |
| /usr/lib/systemd/resolv.conf | Stub address without search domains | Static, minimal |
| A regular file | Whatever another tool writes | Service only reads it |
Changes are inspected and applied with resolvectl: resolvectl query host performs a lookup and shows the link used, resolvectl dns eth0 192.0.2.53 sets servers at runtime, resolvectl flush-caches clears the cache and resolvectl statistics reports cache hits and DNSSEC verdicts.
Security features: DNSSEC and DNS over TLS
systemd-resolved can validate DNSSEC signatures locally and can encrypt upstream traffic with DNS over TLS, but both features require care. The DNSSEC= option accepts yes, allow-downgrade or no, and the compiled-in default differs between distributions, so administrators should check it explicitly.
The allow-downgrade mode validates when the upstream server supports DNSSEC and falls back otherwise, which protects against misconfiguration but not against an active attacker who strips signatures. With DNSOverTLS=opportunistic the service tries TLS but accepts plaintext, while yes enforces encryption and fails closed if the server does not support it.
Common problems and how to diagnose them
Most systemd-resolved incidents stem from conflicting resolv.conf management or misunderstood routing domains. The table below lists typical symptoms with their usual cause and fix.
| Symptom | Likely cause | Fix |
|---|---|---|
| Internal names fail on VPN | VPN link lacks a routing domain | Add ~corp.example to the link |
| DNS leaks outside the VPN | Other links keep default route | Set ~. on the VPN link |
| Port 53 already in use | Stub listener blocks a local DNS server | Set DNSStubListener=no |
| Docker containers cannot resolve | 127.0.0.53 unreachable inside namespace | Give containers upstream servers |
| Stale answers after a change | Cached records still valid | Run resolvectl flush-caches |
A frequent misconception is that cat /etc/resolv.conf shows the real DNS servers. On a system using the stub mode it only shows 127.0.0.53, and the actual upstream servers appear in resolvectl status.
The simple explanation
Every time a computer visits a website, it must turn a name into a numeric address. systemd-resolved is the built-in receptionist that handles those questions on many Linux systems. Programs ask it, and it asks the right outside servers, remembers the answers and replies quickly next time.
Its clever part is knowing whom to ask. Questions about the office network go to the office, and everything else goes to the usual internet provider, just as a receptionist routes calls to the right department.
How it is used in practice
A developer works from home on an Ubuntu laptop and connects to the company network through WireGuard. Internal services live under corp.example and are only known to the company DNS server at 10.20.0.53, while streaming and general browsing should stay on the home connection.
The VPN profile in NetworkManager sets the DNS server to 10.20.0.53 and the domain to ~corp.example, and leaves the home Wi-Fi link as the default DNS route. Running resolvectl query git.corp.example confirms the answer arrives through the wg0 link, while resolvectl query example.org uses the Wi-Fi link.
The result is reliable split DNS without editing resolv.conf: internal names resolve instantly, personal traffic never touches the corporate resolver and disconnecting the VPN removes its DNS settings automatically.