Linux DNS Resolution Failures — resolv.conf, systemd-resolved & nsswitch
Warningnetwork
Overview
Fix Linux DNS resolution failures including 'Temporary failure in name resolution', systemd-resolved issues, resolv.conf overwriting, and nsswitch.conf misconfiguration.
Key Details
- /etc/resolv.conf specifies DNS servers — may be managed by systemd-resolved, NetworkManager, or resolvconf
- systemd-resolved provides a local DNS stub at 127.0.0.53 — resolv.conf should point to this
- /etc/nsswitch.conf controls name resolution order (files, dns, mdns, etc.)
- Docker containers use their own /etc/resolv.conf — 127.0.0.53 does not work inside containers
- VPN software often modifies resolv.conf, breaking DNS when disconnected
Common Causes
- Empty or incorrect /etc/resolv.conf (no nameserver entries)
- systemd-resolved service not running
- NetworkManager or DHCP client overwriting manual resolv.conf changes
- Docker container unable to reach 127.0.0.53 (host-only stub resolver)
- VPN modified resolv.conf and did not restore it on disconnect
Steps
- 1Check current DNS: cat /etc/resolv.conf — should have nameserver entries
- 2Test resolution: nslookup google.com or dig google.com
- 3Restart systemd-resolved: sudo systemctl restart systemd-resolved
- 4Set manual DNS: echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf
- 5For persistent config: edit /etc/systemd/resolved.conf and set DNS=8.8.8.8 1.1.1.1, then restart resolved
Tags
linuxdnsresolv.confsystemd-resolvedname-resolution
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
NetworkManager, DHCP, or systemd-resolved manages it. For systemd-resolved: edit /etc/systemd/resolved.conf instead. For NM: set DNS in the connection profile.