Executing routine command-line operations on a Linux server or desktop—such as updating packages via apt update, cloning repositories with git, or requesting web endpoints using curl—can suddenly halt with the error: “Temporary failure in name resolution”. This diagnostic message indicates that the Linux glibc resolver library is unable to translate human-readable domain names (such as archive.ubuntu.com) into destination IP addresses via DNS. While the term temporary suggests an external internet outage, this fault is frequently caused by local network misconfigurations, broken resolver symlinks, or stalled DNS caching daemons. This technical guide outlines how the Linux DNS lookup pipeline functions and provides practical methods to resolve name resolution failures across Ubuntu, Debian, Fedora, and CentOS distributions.
Why Linux Reports ‘Temporary Failure in Name Resolution’
In modern Linux distributions, DNS lookups pass through several local components before reaching upstream recursive resolvers:
- Misconfigured /etc/resolv.conf: The central resolver configuration file missing valid
nameserverIP addresses or having invalid file permissions. - Broken systemd-resolved Symlink: On systemd-based distributions,
/etc/resolv.confis designed to be a symlink to the systemd-resolved stub. If this link is overwritten or disconnected, lookups fail. - Stalled DNS Daemon: The local caching service (such as
systemd-resolvedordnsmasq) hanging or crashing in the background. - Firewall Dropping Port 53 Traffic: Local firewall rules (via
ufw,iptables, ornftables) or upstream cloud security groups blocking outgoing UDP/TCP packets on port 53. - Static IP Misconfigurations: Network managers configured with a static IPv4 address lacking gateway or DNS server entries.
Method 1: Check Internet Connectivity and Ping IP Addresses
First verify whether the failure is strictly isolated to domain name resolution or represents total network interface disconnect.
- Open your Linux terminal.
- Attempt to ping a public IP address directly (bypassing DNS):
ping -c 4 1.1.1.1 - If the ping succeeds with 0% packet loss, your network routing is healthy and the issue is strictly isolated to DNS resolution.
- If pinging the IP address fails with “Network is unreachable”, verify your physical interface, Wi-Fi association, or default gateway routing using:
ip route show
Method 2: Inspect and Temporarily Update /etc/resolv.conf
Viewing the active resolver definitions reveals whether valid upstream nameservers are currently registered.
- Display the current resolver configuration:
cat /etc/resolv.conf - If the file is completely empty or contains dead internal IPs, open it in an editor with superuser privileges:
sudo nano /etc/resolv.conf - Add reliable public DNS nameservers to the file:
nameserver 1.1.1.1 nameserver 8.8.8.8 - Save the file by pressing Ctrl + O, then Enter, and exit with Ctrl + X.
- Test resolution immediately using
ping -c 3 google.com. If it works, proceed to make the configuration persistent.
Method 3: Restart and Repair systemd-resolved
On modern Ubuntu, Debian, and Fedora systems, systemd-resolved manages local name resolution via a local stub listener at 127.0.0.53.
- Check the operational status of the service:
systemctl status systemd-resolved.service - If the service is inactive or degraded, restart it:
sudo systemctl restart systemd-resolved.service sudo systemctl enable systemd-resolved.service - Ensure
/etc/resolv.confcorrectly points to the systemd stub file:sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf - Inspect active DNS servers recognized by the daemon:
resolvectl status
Method 4: Configure Persistent DNS via Netplan (Ubuntu Server)
Manual edits to /etc/resolv.conf are overwritten by Netplan upon reboot. Configure persistent nameservers in Netplan configuration files.
- Navigate to the Netplan configuration directory:
cd /etc/netplan/ ls -l - Edit the active YAML configuration file (e.g.
01-netcfg.yamlor50-cloud-init.yaml):sudo nano /etc/netplan/01-netcfg.yaml - Under your active interface (e.g.
eth0orenp3s0), define thenameserversblock:ethernets: eth0: dhcp4: true nameservers: addresses: [1.1.1.1, 8.8.8.8] - Preserve exact YAML indentation (use spaces, not tabs).
- Apply the new network configuration:
sudo netplan apply
Method 5: Verify Firewall Rules for Outbound Port 53
If local security rules block outbound UDP or TCP traffic to port 53, DNS queries will time out.
- Check the status of Uncomplicated Firewall (UFW):
sudo ufw status verbose - If the default outgoing policy is set to
deny, allow outbound DNS queries:sudo ufw allow out 53 - Test a direct DNS query using the
digornslookuputility:dig @1.1.1.1 digitash.com - If the query returns a valid answer section with an IP address, DNS communication is fully restored.
For additional Linux administration and server maintenance tutorials, visit the Digitash Terminal section.