Temporary Failure in Name Resolution: What Does it Mean & How to Fix It?

linux temporary failure in name resolution

0 Comment

5 mins Read

linux temporary failure in name resolution

While using Linux, “temporary failure in name resolution” is a common error you might encounter. It usually occurs when trying to access a website, update a program, or execute any task requiring an internet connection.

In essence, this error indicates that your system has failed to resolve a domain name to an IP address. This issue can arise for a number of reasons, but your two usual suspects are internet connectivity problems and DNS (Domain Name System) configuration issues.

Although several scenarios might cause this error, troubleshooting and solutions are easy fixes. By knowing some essential Linux commands, you can resolve the issue in no time. In this article, I’ll explain everything you need to know about fixing the ‘temporary failure in name resolution’ error in Linux systems. But before we get to that, it’s important to understand the underlying reasons behind this error and what causes it.

What Does ‘temporary failure in name resolution’ Mean?

In Ubuntu, the ‘temporary failure in name resolution’ error prevents your computer from adequately connecting to the internet. Because of this, you might not be able to reach websites or use features in applications that require an active internet connection.

You might get this error when trying to ping a website. Here’s an example:

ping google.com

It’s important to understand what name resolution is and how it works to tackle this problem. When you enter a website address, your computer has to convert it from a readable domain into an IP address (e.g., 172.66.40.212) in order to locate the site on the internet. This process is referred to as ‘name resolution’ that DNS servers take care of.

The ‘temporary failure in name resolution’ error occurs when your Linux system fails to contact a DNS server to retrieve a website’s corresponding IP address. The “Temporary” part of the error showcases that this is not necessarily a permanent failure; most of the time, it is due to a configuration or connectivity issue that can be resolved.

What Causes This Error in Ubuntu?

Resolutions for this error are straightforward; the main obstacle is figuring out the underlying reason(s). The first thing you’d want to check is your internet connectivity. A slow or lost connection may be the only reason you’re dealing with this obstacle.

Other than that, a common source for the ‘temporary failure in name resolution’ error is a fault in DNS configuration. The DNS servers your system tries to reach may be unresponsive or unavailable. The DNS resolution mechanism may be malfunctioning or misconfigured. Or the DNS cache may contain old and outdated entries.

Other causes of this error can be related to firewall configurations or incorrect system date and time settings.

How to Fix ‘temporary failure in name resolution’ Error: 4 Main Solutions

There are multiple approaches to solve this error depending on its root cause. Generally, there are four main things to look at. Let’s take a look.

Check Internet Connectivity

Before troubleshooting, it is worth checking that your internet connection is working as it should. Check your internet router and hardware to ensure everything is set up properly. Also, try opening other apps to see if you can get an internet connection through them.

If no application connects to the internet, you can proceed with the next steps.

Check DNS Configurations

Before configuring DNS settings, you must make sure the system user you are operating has administrative privileges. You can click here to learn about giving root/sudo access to an account in Linux.

In Linux systems, the /etc/resolv.conf file contains DNS entries that your system uses to convert domains to IP addresses. Checking via your preferred text editor must contain at least one nameserver. If you’re using nano, for instance, this is how you can check the /etc/resolv.conf file:

sudo nano /etc/resolv.conf

If no DNS nameservers are available, that’s the reason you’re seeing the ‘temporary failure in name resolution’ error. You can go ahead and add one of Google’s open-source DNS configurations. Either of these commands work:

nameserver 8.8.8.8
nameserver 8.8.4.4

To make sure the new DNS configurations are added, you should save and restart the DNS resolver service file. You can do so by running the following command:

sudo systemctl restart systemd-resolved.service

If the DNS resolver is successfully restarted, you won’t get any message on the text editor showcasing that. Now you can ping a random website again to see if the problem is gone:

ping cloudzy.com

If the terminal displays that your system is sending and receiving data, it means your DNS server is functioning as it should.

If you’re still receiving the ‘temporary failure in name resolution’ error, improper file permissions for the /etc/resolv.conf file can be causing it. First, you must ensure the root user account has ownership over the file by running the command below:

sudo chown root:root /etc/resolv.conf

Then, make sure all users across your Linux system have permission to read the file. Use this command to do so:

sudo chmod 644 /etc/resolv.conf

If the error you received was due to misconfigurations with the DNS resolver, the steps mentioned above should fix the issue.

Check Security Programs and Firewall

Firewalls prevent malware and threats from reaching your Linux system. However, if not set up properly, they might block DNS requests when they shouldn’t, causing the name resolution error.

One easy way to check if that’s the case is to temporarily turn off firewalls and other security software like SElinux to see if that resolves the problem. If that fixes the issue, you should reconfigure your firewall settings or the security software you disabled.

Most Linux distributors, such as Debian and Ubuntu, use the UFW firewall. For such systems, you can run these commands to open ports in the firewall:

sudo ufw allow 43/tcp
sudo ufw allow 53/tcp

Then, reload the UFW firewall rules to apply changes:

sudo ufw reload

For CentOS systems, you can use the command below to open ports in Firewall:

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

Again, you should reload the firewall to apply changes:

sudo firewall-cmd --reload

Flush DNS Cache

The DNS cache in your computer is home to many IP addresses. However, outdated or DNS data can prevent you from visitng a webstie you’ve visited before but now has a new domain name or host.

If you’re using Red Hat, you can use this command to flush the DNS cache:

sudo systemctl restart nscd.service

For CentOS systems, use this command:

systemctl restart dnsmasq.service

In another post, we have thoroughly explained everything you need to know about DNS cache and why it is necessary to flush it regularly.

FAQ

Why am I seeing the ‘temporary failure in name resolution’ error in Ubuntu?

This error surfaces whenever your Linux system fails to convert a website’s domain name (e.g., bing.com) into an IP address, typically due to DNS-related issues.

How to fix ping temporary failure in name resolution?

First, ensure you have a proper internet connection. Then, you can reconfigure DNS settings, make sure your system’s firewall isn’t set up to block DNS servers, and flush the DNS cache to resolve the issue.

How to check DNS settings in Linux?

You can see the DNS entries in your system by opening the /etc/resolv.conf file in a text editor.

Two things I love the most; storytelling and technology. My goal is to fuse the two in delivering articles.

Comments

Leave a Comment

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


Latest Posts