Resolve "Temporary name resolution failure" error under Linux

This tutorial will guide you through troubleshooting and correcting the error " Temporary name resolution failure "or " Temporary failure in name resolution "on an English system. A common mistake under Linux.

The mistake " Temporary name resolution failure "This occurs when the system cannot translate the name of a website into an IP address, so it's directly linked to the DNS resolution on your Linux machine. To solve this problem, in some cases you need to adapt the configuration of the local machine, while in others the problem lies elsewhere. For example, a machine that no longer has access to the Internet due to a fault in the Internet connection itself may generate this error.

This error appears when a user attempts to communicate with the Internet, whether to perform an "apt-get update" on Debian or simply to ping the Internet:

ping tutobox.fr

Since the local Linux machine cannot communicate with the DNS server, it returns this error.

The most common causes of this error are the resolv.conf network configuration file and a misconfigured firewall. The steps to follow to correct the error in the two cases I've just mentioned are given in this article.

1. Method 1: Misconfigured resolv.conf file

A. Contents of resolv.conf

Under Linux, especially Ubuntu and Debian, resolv.conf is a file used to configure the DNS servers you wish to use for name resolution.

To begin with, open the "resolv.conf" file in a text editor such as nano or vi. Personally, I usually use "nano".

sudo nano /etc/resolv.conf

Make sure the resolv.conf file contains at least one name server. One name server must be specified per line. Here's an example using the name server "1.1.1.1":

nameserver 1.1.1.1
Linux - Temporary name resolution failure

If the file doesn't contain a name server, add at least one. For example, 8.8.8.8 and 8.8.4.4 are the popular nameservers belonging to Google, and 1.1.1.1 belongs to Cloudflare. There are others.... The choice is yours.

When done, save the file and exit.

Then restart the DNS resolution service.

sudo systemctl restart systemd-resolved.service

Following this modification, you can test that your new DNS server is correctly configured by sending a ping to a website, for example this one :

ping tutobox.fr

If you see the ping command working, this means that DNS resolution is working. Otherwise, the error will continue to be displayed.

B. Misconfigured permissions

If your resolv.conf file contains valid DNS servers, but the error persists, this may be due to incorrectly configured file permissions. Change the file property to root with the following command:

sudo chown root:root /etc/resolv.conf

Change the permissions to allow everyone on the system to read the :

sudo chmod 644 /etc/resolv.conf

When it's done, try pinging again.

ping tutobox.fr

If the error is due to incorrect file permissions, the above commands resolve it successfully! If you still have the error, explore the second method.

2. Method 2: Firewall restrictions

Another reason for the mistake Temporary failure in name resolution "This can be a firewall blocking one or both of the following ports:

  • Le port 43, utilisé pour la recherche whois
  • Le port 53, utilisé pour la résolution des noms de domaine

As a result, we need to open the ports in the local machine's firewall. Here are two examples using UFW and firewalld (firewall-cmd), depending on your environment.

A. Open ports in UFW Firewall

Type the following command to authorize traffic on port 43 using the UFW firewall:

sudo ufw allow 43/tcp

UFW then confirms that the rule has been updated successfully. We need to repeat the command for port 53.

sudo ufw allow 53/tcp

Reload the UFW firewall with the following command:

sudo ufw reload

Both rules are operational, so you can test with a "ping" to see if the error is resolved, as we did previously.

B. Open ports in firewalld

Some Linux distributions, such as Rocky Linux and CentOS, use firewalld as their default firewall, rather than the "ufw" found on distributions such as Debian (even if you have to install it yourself).

The syntax for opening port 43 in firewalld is :

sudo firewall-cmd --add-port=43/tcp --permanent

Then firewalld displays the word "success" in return.

Repeat the command for port 53, resulting in :

sudo firewall-cmd --add-port=53/tcp --permanent

Reload the firewall with the command below:

sudo firewall-cmd --reload

Test the connection by pinging a :

ping tutobox.fr

3. Conclusion

With this article from the tutorial box, you should be able to diagnose and resolve the "Temporary failure in name resolution" error under Linux. If these methods don't work, you may have a firewall at the end of your network preventing you from communicating with your external DNS server, or a NAT configuration fault.

Resources :

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *