How to Fix DNS Issues on Linux
Resolve DNS issues on Linux and clear stale network cache with help from Kudu.
By Kudu Team
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →What Causes This?
DNS issues on Linux usually happen when your system is using the wrong DNS server, a local DNS cache has gone stale, or your network manager has written a bad resolv.conf setting. The problem can also come from a VPN, firewall, router, or ISP blocking or misrouting DNS requests. In some cases, the internet connection itself works, but name lookups fail, so websites and apps cannot translate domain names into IP addresses.
Common Symptoms
- Websites fail to load, but you can still ping a public IP like
8.8.8.8 - Errors such as “Temporary failure in name resolution” or “DNS_PROBE_FINISHED_BAD_CONFIG”
- Package managers like
apt,dnf, oryumcannot reach repositories - Some apps connect slowly or say the server cannot be found
- DNS starts working again after reconnecting to Wi-Fi or rebooting
How to Fix It Manually
-
Check whether DNS is the actual problem
- Open a terminal.
- Run:
ping -c 4 8.8.8.8 - If this works, test DNS directly:
ping -c 4 google.com - If the IP ping works but the domain ping fails, DNS is likely the issue.
-
See which DNS servers your system is using
- In the terminal, run:
cat /etc/resolv.conf - Look for
nameserverentries. - If the file is empty, missing valid servers, or shows a broken local address, that can explain the problem.
- In the terminal, run:
-
Try a known good DNS server
- Temporarily set public DNS servers:
sudo nano /etc/resolv.conf - Add or replace with:
nameserver 1.1.1.1 nameserver 8.8.8.8 - Save the file and test again:
ping -c 4 google.com - If this fixes it, your previous DNS server was likely the problem.
- Temporarily set public DNS servers:
-
Flush the local DNS cache
- Different Linux systems use different DNS services. Try the one that matches your setup:
orsudo systemd-resolve --flush-caches
or restart the resolver service:sudo resolvectl flush-cachessudo systemctl restart systemd-resolved - If you use
nscd, restart it:sudo systemctl restart nscd
- Different Linux systems use different DNS services. Try the one that matches your setup:
-
Restart your network connection
- If you use NetworkManager:
sudo systemctl restart NetworkManager - Then disconnect and reconnect Wi-Fi or Ethernet.
- Test DNS again with:
Ifnslookup google.comnslookupis not installed, use:getent hosts google.com
- If you use NetworkManager:
-
Check for VPN, firewall, or router interference
- Disconnect any VPN and test again.
- If you changed firewall rules recently, temporarily disable them to test.
- Restart your router, then reconnect your Linux machine.
- If DNS only fails on one network, the router or ISP DNS may be the cause.
-
Make the DNS change permanent
- If your system overwrites
/etc/resolv.conf, update DNS through NetworkManager instead:nmcli con show - Find your active connection name, then set DNS:
sudo nmcli con mod "Your Connection Name" ipv4.dns "1.1.1.1 8.8.8.8" sudo nmcli con mod "Your Connection Name" ipv4.ignore-auto-dns yes sudo nmcli con up "Your Connection Name" - This prevents bad DNS values from returning after reboot or reconnect.
- If your system overwrites
Fix It Automatically with Kudu
If you do not want to dig through DNS settings, cache services, and network configuration by hand, Kudu can help automate the cleanup. It can detect stale network cache, repair common connectivity issues, and apply safe fixes faster than manual troubleshooting.
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →Related guides
How to Fix Package Manager Issues on Linux
If your Linux package manager is failing, Kudu can help clean cache and leftover package files.
How to Fix DNS Issues on Windows
Resolve Windows DNS issues and clear stale network caches with Kudu to restore reliable browsing.
How to Remove App Cache on Linux
Clean application cache on Linux to recover space and reduce clutter using Kudu.
How to Fix Apps Opening Slowly on Linux
If Linux apps take too long to open, Kudu can help clean caches and reduce system clutter.