Linux DNS Troubleshooting — systemd-resolved, /etc/resolv.conf, and DNS Debugging
Warningnetwork
Overview
Fix Linux DNS resolution issues including systemd-resolved conflicts, /etc/resolv.conf management, DNS-over-HTTPS setup, and debugging DNS with dig and nslookup.
Key Details
- Modern Linux uses systemd-resolved for DNS management — /etc/resolv.conf is often a symlink
- Multiple DNS resolution paths can conflict: systemd-resolved, NetworkManager, manual /etc/resolv.conf
- systemd-resolved listens on 127.0.0.53 which can confuse applications expecting a real DNS server
- dig and nslookup bypass systemd-resolved and query DNS servers directly
- resolvectl (or systemd-resolve) shows the current DNS configuration per network interface
Common Causes
- /etc/resolv.conf overwritten by NetworkManager, VPN, or DHCP client
- systemd-resolved not running or misconfigured
- VPN client replacing DNS settings, breaking resolution after disconnection
- Multiple DNS management systems conflicting (resolved + NetworkManager + manual)
- DNS server unreachable or returning SERVFAIL for specific domains
Steps
- 1Check current DNS: resolvectl status to see DNS servers per interface
- 2Test resolution: dig example.com (uses system DNS) and dig @8.8.8.8 example.com (bypass local)
- 3Check resolv.conf: ls -la /etc/resolv.conf to see if it is a symlink and where it points
- 4Set DNS manually: resolvectl dns eth0 8.8.8.8 1.1.1.1 for systemd-resolved
- 5Fix for containers/Docker: add DNS=8.8.8.8 to /etc/systemd/resolved.conf and restart systemd-resolved
- 6Flush DNS cache: resolvectl flush-caches
Tags
dnsresolv-confsystemd-resolveddigname-resolution
Related Items
More in Network
windows-651-pppoe-connection-failedWindows Error 651 — PPPoE Connection Failed
Warningwindows-691-authentication-failedWindows Error 691 — Authentication Failed
Warningwindows-720-ppp-connection-failedWindows Error 720 — PPP Connection Failed
Errorwindows-800-vpn-tunnel-failedWindows Error 800 — VPN Tunnel Failed
Warningwindows-network-error-619Windows VPN Error 619 — Connection Could Not Be Established
Warningwindows-network-error-868Windows VPN Error 868 — Remote Server Not Resolved
WarningFrequently Asked Questions
Multiple services manage it: systemd-resolved, NetworkManager, and DHCP clients. Check which manages it with ls -la /etc/resolv.conf. Use the managing service's configuration instead of editing resolv.conf directly.