3 Ways To Fix the “Temporary failure in name resolution” Error

Temporary failure in name resolution

In simple terms, the Temporary failure in name resolution error happens when the system can’t match a website’s address to a corresponding internet address or location.

This error can occur for many reasons, including losing internet connection.

In this article, we will discuss this error in detail. We will discuss possible causes and three possible fixes that you can apply to resolve the issue and restore internet connectivity.

Let’s start with a look at this error.

Table Of Content

  1. What Does ‘Temporary failure in name resolution’ Mean?
  2. How Can We Solve the “Name resolution temporary failure” Error?
  3. Allowing Ports in UFW Firewall
  4. Allowing Ports in Firewalld
  5. Conclusion
  6. FAQs

What Does ‘Temporary failure in name resolution’ Mean?

The Temporary failure in name resolution error is a problem that stops your computer from connecting to the internet properly. Because of this disruption, you may be unable to add new programs, send or receive emails, or make internet requests through applications.

Another aspect of this error is that it can happen anytime when you try to visit a website, update your computer, or in general carry out any task that needs the internet to work.

For example, this error can happen when you use a command like ping.

# ping redswitches.com

The system will display a Temporary failure in name resolution error because it cannot reach the DNS server(s).

What Causes the “Temporary failure in name resolution” Error?

The main challenge in resolving this error is finding the cause and fixing the underlying reasons. Here are some common issues you should check when investigating the issue:

  • Loss of Internet connectivity.
  • Device configuration for DNS server use is incorrect.
  • DNS servers are unresponsive or unavailable.
  • The DNS cache has reached capacity.
  • The system’s firewall is blocking DNS requests.
  • The DNS resolution mechanism is malfunctioning.
  • The home network router’s configuration is filtering out the DNS traffic.
  • SELinux (Security-Enhanced Linux) or AppArmor is blocking DNS requests 
  • DNS lookups are disabled in the /etc/nsswitch.conf file.
  • Failure to update the relevant packages in the Linux distribution.
  • Presence of malware that causes DNS spoofing or hijacking attempts.
  • Issues with the DNS provider.
  • DNS settings, including network settings and DNS server addresses, are misconfigured.
  • Incorrect settings for system time and date.

Here are the steps to resolve the error in these situations:

How Can We Solve the “Name resolution temporary failure” Error?

As you saw, the underlying issues that cause the error can be very diverse. That’s why there is no single solution that works in all cases. We will discuss three solutions so that you can try fixes that target a broad range of causes.

But before that, let’s briefly see what you need to apply these fixes.

Prerequisites to the Fixes

Before you start, make sure you have the following:

  • An account with sudo or root access. 
  • Stable internet connection.

Solution #1: Check Internet Connection

The first thing you should do is check if your internet connection is properly up and working properly.

Once you have checked the hardware connection, go back to the application and retry. If you still face connectivity issues, try another application to check internet connectivity.

If other applications also can’t connect to the internet, that could be the main issue.

Solution #2: Check resolv.conf File for Configuration Errors

The resolv.conf file is used to set up DNS servers on Linux systems. Any misconfiguration in this file can result in a name resolution error because of misdirected name resolution requests.

That’s why you should make sure this file is set up correctly. In most cases, you should check the following two areas.

Add a Nameserver

  • Use your preferred text editor to open the resolv.conf file. We’ll use the vi editor to edit the file:
    • # vi /etc/resolv.conf
  • Check that the resolv.conf file has at least one nameserver, and the lines for nameservers should appear as follows:nameserver 8.8.8.8Add at least one entry if no nameserver is listed in the file. You can use popular nameservers like 8.8.8.8 and 8.8.4.4, which are owned by Google, or the nameservers provided by your hosting provider.

add nameservers

  • Save the file and then exit the text editor.
  • Now you need to restart the DNS resolution service by running the following command in the terminal:
    • # systemctl restart systemd-resolved.service
    • If everything goes well, the command will not display any status or error message.
  • Now, try pinging a website to check if the new nameservers are set up correctly:
    • # ping redswitches.com

ping command

If you observe the ping command sending and receiving data, your DNS server is functioning correctly.

Incorrect Permissions

If the resolv.conf file has the properly-configured DNS servers, but the error persists, the next thing you should check is file permissions. Incorrect or insufficient file permissions can result in connectivity disconnection.

Follow these steps to make sure the permissions are set correctly:

  • Give the ownership of the file to the root user with the following command:
    • # chown root:root /etc/resolv.conf
  • Now, change the file permissions to allow all users to read the file. This will resolve name resolution issues for all users.
    • # chmod 644 /etc/resolv.conf
  • Try pinging a website once more.
    • # ping redswitches.com

If the error was due to incorrect file permissions, the above steps should fix the problem.

Solution #3: Firewall Restrictions

The system firewall controls all outgoing DNS requests. As such, the firewall can block the following ports and cause the Temporary failure in name resolution error:

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

We will now discuss how to open these ports in UFW and firewalld, two popular firewall solutions in Linux environments.

Allowing Ports in UFW Firewall

If you are using the UFW firewall, follow these steps:

  • Use this command to open port 43:
    • # ufw allow 43/tcp

UFW will confirm that the rule has been successfully updated.

ufw allow

  • Repeat the same command for Port 53.
    • # ufw allow 53/tcp
  • Reload UFW to ensure the new rules are in effect
    • # ufw reload

The output will indicate that the rules have been successfully reloaded.

ufw reload

  • Verify the connection by pinging a website.
    • # ping redswitches.com

Allowing Ports in Firewalld

If your Linux distribution uses firewalld as the default firewall, you can follow these steps to open ports:

  • Use the following command to open Port 43 in firewalld:
    • # firewall-cmd --add-port=43/tcp --permanent

firewall will display success if the operation is successful.

firewall add port

Repeat the same command for Port 53.

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

  • Reload the firewall
    • # firewall-cmd --reload

firewall reload

  • Verify the connection by pinging a website.
    • # ping redswitches.com

Conclusion

Resolving the Temporary failure in name resolution error involves troubleshooting network connectivity, checking and modifying the resolv.conf file, and adjusting firewall settings. By addressing these issues, you can ensure seamless internet connectivity.

RedSwitches offers the best dedicated server pricing and delivers instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.

FAQs

Q. What does the “Temporary failure in name resolution” error indicate in Linux?
This error in Linux indicates a temporary failure in resolving domain names through the Domain Name System (DNS) servers, which affects network connectivity and the ability to translate a domain name to an IP address.

Q. How can I troubleshoot and fix the “Temporary failure in name resolution” error?
You can troubleshoot and resolve this issue by checking your internet connection, validating your DNS settings, checking network connectivity, configuring DNS servers, and verifying that your system can resolve domain names properly.

Q. What steps can be taken to check network connectivity to resolve the “Temporary failure in name resolution” error?
To check network connectivity, you should ensure that you have a working internet connection, verify that your DNS settings are configured correctly, and troubleshoot any network connectivity issues that may be affecting DNS resolution.

Q. How do I configure DNS settings to resolve the “Temporary failure in name resolution” error?
You can configure DNS settings by editing the DNS configuration file, which contains valid DNS server entries, and ensuring that your system is using the correct DNS servers for domain name resolution.

Q. What are some common causes of the “Temporary failure in name resolution” error in Linux?
This error can be caused by issues with DNS configuration, DNS cache, firewall settings, network connectivity problems, or the failure to resolve domain names through the DNS servers.

Q. What role does DNS resolution play in addressing the “Temporary failure in name resolution” error?
DNS resolution is crucial to resolving domain names to their corresponding IP addresses, and addressing the “Temporary failure in name resolution” error involves validating and configuring the DNS settings to ensure proper domain name resolution.