How to fix the “Temporary failure in name resolution” Error

Browsing the internet is perhaps the most important aspect of using any operating system. Opening various websites on browsers are extremely common as they contain all sorts of content. As we attempt to browse through the internet and these various websites using the Linux terminal, there is a very common issue that may be invoked with the statement “Temporary failure in name resolution“.

This article will elaborate further on the main reasoning causing this error and also demonstrate how this problem can be fixed on any system.

Resolve the “Temporary failure in name resolution” Problem

There exist a couple of major causes that will cause this problem to be invoked. This problem is mostly invoked if the user attempts to ping a certain website using the following terminal command:

$ ping

Let’s look at the major reasons for this issue.

Reason 1: The resolv.conf File Not Set Up

This file is utilized to configure the DNS on your system. What this means is that when a ping command is issued, this file will resolve the name of the domain to the IP address of that domain, which means that it contains the data that attaches the domain to their respective IP Address. Once this happens, the website will be located, and then the system will be able to ping that website. If this file is missing or it is not set up correctly, then this error will be prompted as demonstrated below:

Solution: Configure the File

The most effective solution to this issue is to create the “resolv.conf” file on your system and set it up in the correct way to make it functional. The first step is to create the file within the “etc” directory as demonstrated below:

$ sudo vi /etc/resolv.conf

This command will either open up the file that currently exists or it will make a new file. Once the file opens, scroll down and find the following line to check if it exists:

If you can locate this inside your file, then skip to the next possible reason for this issue. Otherwise, continue with these steps. The next step is to open this file in an editor and add the following line to your file if it does not already exist:

$ sudo gedit /etc/resolv.conf

The file shown above will open up. Add the command shown below into that file, then save and exit as shown:


After saving, utilize the ping once again, and you will see that the error has been resolved as shown below:

Reason 2: Firewall Problem

The second possible reason behind this issue is that certain firewall settings are stopping your command from working. These firewall settings revolve around port 53 and port 43. The 53 is utilized for DNS in your system, whereas the 43 is used for whois lookup, which is a protocol that is used for answering various TCP-based queries which is a standard protocol for various requests that are made.

Solution: Turn Off the Firewall Setting

To resolve this issue, the user simply needs to turn off the firewall for port numbers 53 and 43. This will enable those two settings and hence allow the DNS and whois to be utilized by the system. To disable the firewall for these ports, simply run the commands below:

$ sudo ufw allow 53/tcp

This command enables port 53, meaning that the firewall will no longer block the DNS on your system.

$ sudo ufw allow 43/tcp

This command enables port 43, meaning that the firewall will no longer block the protocol for blocking TCP queries.

$ sudo ufw reload

This command is used to reload the firewall on your system to apply the changes that are made to the system. All the commands mentioned above are demonstrated below:

Once reloaded, the error should no longer occur on your system.


The “Temporary failure in name resolution” problem is invoked due to 2 major reasons. One is that the “resolve.conf” file does not have its configuration completed correctly on your system. The other reason is that the firewall blocks ports “53” and “43” on your system. To fix this error, enable ports 53 and 43 on your firewall using the terminal. The other solution is to configure the “resolv.conf” correctly. This article has given a detailed guide on the reasoning behind this issue and demonstrated how it could be fixed.