Linux Networking

Flush DNS cache with systemd-resolved

Clear resolver cache after DNS migrations on modern Linux desktops and servers.

6 min read Beginner Updated 9 Jun 2026

Step-by-step guide

Work through each section in order. Stop when your issue is resolved — you do not need every step for every situation.

Warning

Use a sudo-capable account, keep shell history for audit, and back up critical paths before changing boot, SSH, or package state.

What you will achieve

Clear resolver cache after DNS migrations on modern Linux desktops and servers.

1) Flush cache

sudo resolvectl flush-caches

2) Check cache stats

resolvectl statistics

3) Restart service if stale records persist

sudo systemctl restart systemd-resolved

Related guides

dns systemd-resolved