How to Resolve the “Temporary Failure in Name Resolution” Error

Encountering the “Temporary failure in name resolution” error can be a real inconvenience, especially when you need to access websites or online resources quickly. This error typically occurs in Linux or other Unix-based operating systems when the system cannot resolve a domain name into its associated IP address. In this post, we’ll walk through several methods to help you fix the issue and get back online.
Causes of the “Temporary Failure in Name Resolution” Error
Several factors can cause this error, including:
-
Incorrect DNS Configuration: If your system’s DNS settings are misconfigured, it can lead to resolution issues.
-
Network Connectivity Problems: Issues with your internet connection can prevent the system from reaching the DNS servers.
-
Firewall or Security Restrictions: Firewalls may block DNS queries, causing name resolution failures.
-
DNS Server Issues: The DNS server you’re using could be down or experiencing technical issues.
How to Fix the “Temporary Failure in Name Resolution” Error
Here are some effective solutions to resolve the error:
1. Check Your Network Connection
First, ensure your internet connection is active. A quick way to test your connection is by pinging a known IP address, such as Google’s DNS server:
If you receive replies, your connection is working fine. If not, you may need to troubleshoot your network connection.
2. Verify DNS Configuration
The next step is to check your DNS settings. The system’s DNS servers are typically listed in the /etc/resolv.conf
file. Open this file with a text editor like nano:
You should see lines similar to this:
If the DNS servers are incorrect or the file is empty, add or update the nameserver entries. Google’s public DNS servers (8.8.8.8 and 8.8.4.4) are reliable choices.
3. Restart Network Service
After making changes to the DNS configuration, restart your network service to apply the updates. For most Linux distributions, you can use:
Alternatively, use the service command:
4. Check Firewall Settings
Firewalls can sometimes block DNS traffic. To see if this is the issue, temporarily disable your firewall and check if the error persists. If you’re using ufw
(Uncomplicated Firewall), you can disable it with the following command:
If disabling the firewall resolves the issue, update your firewall settings to allow DNS traffic (port 53).
5. Verify Network Interface Configuration
Incorrect network interface settings can also cause DNS resolution issues. Check your network interface configuration file, typically located at /etc/network/interfaces
or in /etc/netplan
on newer versions like Ubuntu. Ensure that the DNS settings are correctly specified, as in the example below:
If the DNS settings are incorrect or missing, update them accordingly.
6. Update Your System
Occasionally, bugs in network components can cause DNS resolution issues. Make sure your system is up to date by running the following commands:
This will install the latest updates, which may fix any bugs causing the issue.
7. Use a Different DNS Resolver
If the problem persists, try switching to a different DNS resolver. In addition to Google’s DNS, other reliable options include Cloudflare’s DNS (1.1.1.1) and OpenDNS (208.67.222.222). Update your /etc/resolv.conf
file as follows:
8. Make DNS Changes Persistent
Changes to /etc/resolv.conf
can sometimes be overwritten by network managers. To ensure your DNS settings persist, configure your network manager directly. For NetworkManager, create or edit the configuration file:
Add the following lines:
Save and close the file, then restart NetworkManager:
9. Use DNS Diagnostic Tools
If the error persists, use tools like dig
or nslookup
to diagnose the DNS resolution problem. First, install the necessary tools if they aren’t already installed:
You can then use dig
or nslookup
to query a domain:
Look at the “ANSWER SECTION” to see if the domain resolves correctly. Similarly, use nslookup
:
These tools will provide more detailed output to help pinpoint where the resolution process is failing.
Conclusion
The “Temporary failure in name resolution” error can arise from various issues, including DNS misconfigurations, network problems, or security settings. By following the steps outlined above, you can resolve the error by checking your network connection, verifying DNS settings, adjusting firewall rules, and ensuring your system is up to date. With these solutions, you should be able to restore proper DNS resolution and get back to browsing the web without further interruptions.