Prerequisites
To proceed with the solutions outlined below, ensure you have sudo or root privileges and a functional internet connection.
- User must have sudo or root privileges
- Stable and working network connectivity
What is the Temporary Failure in Name Resolution Error
When we access a website, our system browser sends a request to a DNS server that will translate the domain name into an IP address. This IP address will connect the website’s server and load the content. If the DNS server fails to provide the IP address, the “Temporary failure in name resolution” error message appears.
For example, if we ping the website from a system, you may experience the following error:
Here the system failed to connect to the DNS server hence resulting in error.
The main three main reason why this error occur includes:
- Slow or No Internet Connection
- Badly Configured resolv.conf File
- Misconfigured resolv.conf File Permissions
- Firewall Restrictions
- Open the Ports in UFW Firewall
Solution 1: Slow or No Internet Connection
The first solution to resolve the error is straightforward as the user can check the internet connectivity on the system. If the internet is slow or not connected, you may experience this error.
Solution 2: Badly Configured resolv.conf File
The resolv.conf file sets up the DNS servers on Linux. Open the resolv configuration file in nano editor:
Make sure at least one nameserver is present inside the resolv.conf file. The nameserver looks like this:
Here in our case nameserver is:
If no nameserver is present in the system. Defined any of the nameservers. Some of the well-known name servers owned by Google are 8.8.8.8 and 8.8.4.4. By editing the resolv.conf file any of the nameserver can be defined.
Save the file and restart DNS service:
If the DNS server is restarted successfully no output will be returned.
You can also verify the DNS server by again pinging a website:
If communication is established with the website this means the DNS server is now working.
2.1. Misconfigured resolv.conf File Permissions
In some cases, despite the proper DNS server defined inside the resolv.conf file, the error persists. This may be due to file permission missing. Change the ownership access to root user by running the given command:
Run given command to give permission to each user to allow them to modify the resolv.conf file:
Now we will again ping the website.
If the error is due to wrong permission, the above commands will solve it.
Solution 3: Firewall Restrictions
Another reason for the “Temporary failure in name resolution” error is due to a firewall blocking access to the necessary ports, which includes port 43 used for whois lookup and port 53 used for domain name resolution.
3.1. Open the Ports in UFW Firewall
If the error is caused by blocking of port 43, run the below given command to allows traffic on this port:
The Uncomplicated Firewall (UFW) confirms that rules have been successfully updated.
Similarly, we can also allow the permission for port 53 using:
Note: Sometime our UFW firewall is not enabled by default, so to enable it, use:
Now, reload the UFW firewall to apply the changes:
Conclusion
The error “Temporary failure in name resolution” can occur due to no internet connection, missing DNS nameserver or resolv.conf file permissions or firewall restriction. Main solution to this problem is to fix the internet problem, allow the resolv.conf file access to all users or unblock the UFW firewall protection at port 43 and port 53.