How to Resolve the "Temporary failure in name resolution" Error

November 9, 2023


The "Temporary failure in name resolution" error occurs when the system cannot translate a domain name into an IP address. While the error sometimes appears due to a lost internet connection, there are multiple reasons why it may show up.

This tutorial will guide you through troubleshooting and fixing the "Temporary failure in name resolution" error.

Temporary failure in name resolution - how to fix the error.


What Does "Temporary failure in name resolution" Mean?

The "Temporary failure in name resolution error" is an error that causes network connectivity issues on your system. It can prevent you from installing packages, prevent sending or receiving emails, or result in failed network requests.

The error appears when a user attempts to communicate with a website, update the system, or do anything that requires an active internet connection.

For example, it can occur when using a command such as ping:


The system cannot communicate with the DNS server and returns the error:

"Temporary failure in name resolution" error message after pinging a website unsuccessfully.

"Temporary failure in name resolution" Causes

The error can have different causes, and some of the common ones are:

  • No internet connection or a slow one.
  • A badly configured resolv.conf network configuration file.
  • A misconfigured firewall application.

The steps to fix the error in these cases are given below.

How to Fix "Temporary failure in name resolution"?

This section provides several possible solutions for fixing the "Temporary failure in name resolution" error.

Solution 1: Check Internet Connection

The first step when troubleshooting the error is to check your internet connection. Make sure that you don't have general connectivity issues that are causing the error. If your other apps don't have internet access, it may be the root of the problem.

Check the router and make sure all cables are plugged in if you are on LAN. If your other apps have internet access, proceed to the next solution.

Solution 2: Badly Configured resolv.conf File

The resolv.conf file is a file for configuring DNS servers on Linux systems. Follow the steps below to ensure the file is configured correctly.

Add a Nameserver

1. Open the resolv.conf file in a Linux text editor such as nano.

sudo nano /etc/resolv.conf

2. Make sure the resolv.conf file contains at least one nameserver. The lines listing nameservers should look like this:


Add at least one if you do not have a nameserver listed in the file. and are the popular nameservers owned by Google, but you can add any functional DNS server to this list.

Editing the /etc/resolv.conf file in nano editor on Linux.

3. Save the file and exit.

4. Next, restart the DNS resolver service. Run the following command:

sudo systemctl restart systemd-resolved.service

If successful, the command above returns no output.

5. Test that your new nameservers are correctly configured by pinging a website:

Successfully pinging a website.

If you see the ping command transmitting and receiving data, your DNS server is working properly.

Note: If you are using Ubuntu, check out our guide on how to configure DNS Nameservers on Ubuntu.

Misconfigured Permissions

If your resolv.conf file contains valid DNS servers, but the error persists, it may be due to misconfigured file permissions. Follow the steps below to ensure the permissions are set correctly:

1. Change the ownership of the file to the root user with the following command:

sudo chown root:root /etc/resolv.conf

2. Modify the user permissions to allow everybody on the system to read the file:

sudo chmod 644 /etc/resolv.conf

3. Ping a website again.


If the wrong file permissions caused the error, the commands above successfully resolve it.

Solution 3: Firewall Restrictions

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

  • Port 43, used for whois lookup.
  • Port 53, used for domain name resolution.

Open Ports in UFW Firewall

Follow the steps below if you use UFW firewall:

1. Run the following command to open port 43:

sudo ufw allow 43/tcp

UFW confirms the rule is successfully updated.

Allowing port 43 in UFW.

2. Repeat the command for port 53.

sudo ufw allow 53/tcp

3. Reload UFW by running the following command:

sudo ufw reload

The output confirms the operation was successful.

Reloading UFW firewall.

Open Ports in firewalld

Some Linux distributions use firewalld as their default firewall. Follow the steps below to open the ports if you use firewalld:

1. Run the following command to open port 43 in firewalld:

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

firewalld outputs the word success.

Allowing port 43 in firewalld.

2. Repeat the command for port 53.

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

3. Reload the firewall.

sudo firewall-cmd --reload
Reloading firewalld firewall.

4. Test the connection by pinging a website.


Note: Check out our post on DNS troubleshooting as well.


This article provided ways to troubleshoot and fix the "Temporary failure in name resolution" error on Linux.

Learn more about diagnosing DNS-related problems by reading our article on how to use Linux dig command.

Was this article helpful?
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
How to Disable or Turn Off Firewalld on CentOS 7
August 15, 2019

There are situations when admins need to disable firewalld for testing or switching to another firewall tool, like iptables. This tutorial will show you how to disable and stop the firewall on CentOS 7.
Read more
How to Enable/Disable UFW Firewall on Ubuntu 18.04
August 18, 2019

UFW firewall is an easy to use solution for server firewall settings management. This tutorial shows you how to disable and enable an Ubuntu UFW firewall using the command line.
Read more
How to set DNS Nameserver on Ubuntu 20.04
May 18, 2021

By default, most networks are configured to work with DNS servers supplied by the internet service provider. This tutorial will show you how to change DNS nameservers on your Ubuntu machine.
Read more
What is a Domain Name System (DNS) & How Does it Work?
November 9, 2023

DNS first emerged in the early 1980s. It represents a system of interconnected servers that store registered domain names and IP addresses.
Read more