In Ubuntu and Debian-based distributions, systemd-resolved operates as the default network name resolution service, providing local DNS caching, LLMNR, and DNSSEC validation across network interfaces. Under normal circumstances, this daemon consumes negligible system resources. However, when misconfigured DNS search domains, aggressive mDNS broadcasting, cyclic query loops, or unresponsive upstream nameservers occur, systemd-resolved can spike to 100 percent CPU utilisation, driving up fan speeds and causing system lag. Resolving this requires breaking DNS loops, optimising DNSSEC settings, and resetting the local stub resolver.
Identify DNS Query Loops and Spiking CPU
Before modifying system configurations, inspect live process performance and system logs to confirm that systemd-resolved is indeed the culprit and examine incoming query volume.
- Open a terminal window and inspect active CPU usage:
top -p $(pgrep -d',' -f systemd-resolved) - Inspect recent resolution logs and daemon statistics:
resolvectl statistics - Check journal logs for recurring query retransmissions or loop warnings:
sudo journalctl -u systemd-resolved -e -n 50 - If you observe hundreds of repeated queries for the same local hostname or reverse IP lookups within seconds, a loop is actively running between local network tools (like Docker or local VPN proxies) and the systemd stub listener.
Disable or Downgrade DNSSEC Validation
By default, Ubuntu enables opportunistic DNSSEC validation. When upstream routers or internet service providers modify DNS responses or fail to support cryptographic signing, systemd-resolved continuously recalculates validation signatures, consuming excessive CPU cycles.
- Edit the primary configuration file using nano:
sudo nano /etc/systemd/resolved.conf - Locate the
[Resolve]section. - Add or uncomment the DNSSEC line and set it to allow-downgrade or no:
DNSSEC=allow-downgrade - Disable Multicast DNS (mDNS) if you are on a congested local network with thousands of broadcast packets:
MulticastDNS=no - Press Ctrl + O and Enter to save, then press Ctrl + X to exit.
- Restart the service:
sudo systemctl restart systemd-resolved
Flush the Local DNS Cache
Stale or corrupted negative cache entries (caching NXDOMAIN answers) can cause applications to trigger endless query bursts.
- Flush all cached DNS records stored in the memory buffer:
sudo resolvectl flush-caches - Verify that the cache counters have reset:
resolvectl statistics - Observe CPU utilisation in
topto verify whether usage normalises.
Configure Explicit Upstream DNS Servers
If your local DHCP router delivers slow or unresponsive DNS servers, systemd-resolved spends substantial processor time managing timeout fallbacks across multiple network interfaces.
- Open
/etc/systemd/resolved.confagain:sudo nano /etc/systemd/resolved.conf - Specify reliable public upstream DNS servers under the
[Resolve]section:DNS=1.1.1.1 8.8.8.8 FallbackDNS=1.0.0.1 8.8.4.4 - Save the file and restart the resolver daemon:
sudo systemctl restart systemd-resolved
Reset the Stub Resolver Symlink
If third-party network managers or VPN clients have altered /etc/resolv.conf, queries may bypass the internal cache entirely and flood the network stack.
- Verify that
/etc/resolv.confcorrectly symlinks to the systemd stub file:ls -l /etc/resolv.conf - If the symlink is missing or points to an invalid path, recreate it cleanly:
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf - Restart both NetworkManager and systemd-resolved:
sudo systemctl restart NetworkManager systemd-resolved