Solve Temporary Failure in Name Resolution Error in linux

Solve Temporary Failure in Name Resolution Error in Linux

Today, connecting to the Internet is necessary for various purposes because if you do not succeed in connecting to the Internet, many of your tasks will be challenged. You may get the ‘temporary failure in name resolution’ error when updating the Linux system, pinging and connecting to the website, or other essential tasks that require connecting to the Internet and your public and local network.

This error means the system has encountered problems translating domain names to IP addresses using DNS (Domain Name System). Displaying the ‘temporary failure in name resolution’ error in linux has several reasons discussed in this article. This article is a step-by-step guide to help you troubleshoot name resolution errors, which will provide solutions to fix Linux Unablity to Resolve DNS problems.

What is the Name Resolution issue impact on your system?

As you know, DNS is an Internet phone book of IP addresses of devices in the public Internet network that translates hostname to IP address to establish communication between devices in the network. When you type a specific hostname in your system’s browser, the system translates the hostname into the corresponding IP address to communicate, and for this purpose, it interacts with the DNS server configured in the network.

If you receive a ‘temporary failure in name resolution’ error in linux ubuntu and other distributions when connecting, you should know that the system has a problem correctly translating the domain name to the IP address. This problem can originate from your system or be due to an internet connection, DNS configuration, etc., which should be checked.

Name resolution problem, including DNS, significantly affects individual systems and the network. In this part of the article, we will talk about the impact of name resolution issue:

  • delays or failures in accessing resources and services such as websites, applications, or services
  • timeouts or errors in scripts, automated systems, and web-based applications that rely on DNS for communication and authentication
  • Disruption of email communications and Failed Email Delivery
  • Decreased overall network performance due to increased traffic caused by repeated failed DNS requests
  • security risks, such as DNS spoofing or hijacking
  • Disrupting remote connections such as VPN connections and preventing users from securely accessing internal resources

Therefore, the name resolution error has negative effects on the performance of networks and systems; after becoming aware of this problem through the behaviors and signs that occur in the system or receiving “Server Not Found” and “DNS Error” errors, disruptions in connecting devices with each other in the local network, failure to communicate with external servers, receiving “ERR_NAME_NOT_RESOLVED” error, and similar things in the browser, you can quickly identify the problem and reduce these effects.

Reasons for ‘temporary failure in name resolution’ error

  • lost internet connection
  • Incorrect configuration of your device to use DNS servers
  • Unresponsiveness and unavailability of DNS servers
  • DNS cache is full
  • Blocking DNS requests in the firewall
  • Malfunction of the DNS
  • DNS traffic filtering in the configuration of your router in the home network
  • Blocking of DNS requests by SELinux (Security-Enhanced Linux) or AppArmor
  • Disabling DNS lookups in /etc/nsswitch.conf file
  • Failure to update package manager for Linux distribution
  • Malware in Linux systems and DNS spoofing or hijacking attempts
  • Problems related to the DNS provider
  • Misconfiguration of DNS settings, including network settings and DNS server addresses
  • Incorrect system time and date settings

Prerequisite to fix DNS Resolution Failed in Linux

You need root /sudo privileges to fix Linux’s inability to communicate with the DNS servers. Also, you should check the internet connection and ensure a stable internet connection. In addition, for the solutions to this error to function and resolve your issue, you must use a Linux VPS or Linux system because the instructions in this article are for fixing linux dns resolution error.

how to fix ‘temporary failure in name resolution’ error in Linux

If you see the “Temporary failure in name resolution” error, don’t worry because here, you will learn how to troubleshoot and resolve this issue on a Linux system.

1. Check Network Connectivity

If your device’s internet connection is disconnected, you will have trouble accessing your desired website’s IP address or hostname. Therefore, one of the primary methods to solve this problem is to check whether your network connection is active and ensure that the device has a stable connection to the Internet. To do this, run the Ping command to check the network connection and access to the desired website:


If you receive the “temporary failure in name resolution” error in linux output, it means that the system failed to communicate with the DNS server, and a problem in the network connection may cause this.

Also, this problem can be due to a typo of the domain name, which you should make sure of the website’s domain name’s correctness, or you can try a different domain to check this problem. The DNS of the desired domain may cause the problem.

2. Check DNS Configuration

/etc/resolv.conf file is used in Linux systems to configure DNS servers. This file contains DNS entries that the Linux system uses to resolve domain names to IP addresses. Incorrect configuration of the /etc/resolv.conf file is one of the common reasons for displaying the ‘temporary failure in name resolution’ error, so checking the correctness of the DNS settings in the /etc/resolv.conf file and changing the DNS server settings in Linux (if necessary) are helpful solutions to this problem.

To check the DNS configuration file in a Linux system, open the /etc/resolv.conf file using your favorite editor, such as nano or vi, and check the DNS server addresses:

sudo nano /etc/resolv.conf


sudo vim /etc/resolv.conf

Note: You must have root privileges to open the /etc/resolv.conf file.

The DNS configuration file should contain lines similar to the following lines:


If the file does not contain a nameserver, you can add a public nameserver belonging to Google with the desired IP address (such as and to the file. Then save the file and restart the DNS resolver service by running the following command:

sudo systemctl restart systemd-resolved.service

No output will be shown if the DNS resolver service is restarted successfully.

To ensure that the resolver is running, you can check its status by running the following command:

sudo systemctl status systemd-resolved.service

Then, by pinging any website, you can check if the name resolution problem is solved or not:


As a result, you should see transmitting and receiving data in the output of the Ping command and ensure the name servers’ correct configuration.

Note: Most Linux distributions support the Network Manager tool, which automatically rewrites and manages the /etc/resolv.conf file. After manually editing the /etc/resolv.conf file, create a symbolic link to /dev/null to preserve and save the changes you made manually to the DNS configuration file:

sudo ln -sf /dev/null /etc/resolv.conf

It should be noted that the network management tools are practical tools for DNS settings in Linux distributions, which has many advantages for optimal DNS management.

You may be wondering what to do if you are sure of the correct DNS configuration in the /etc/resolv.conf file but you still get an error? If the DNS configuration file contains valid DNS servers, the incorrect configuration of file permissions may cause this error. To solve this problem, you need to set the ownership of the resolv.conf file to the Root user:

sudo chown root:root /etc/resolv.conf

To allow all users to access the content of the file, run the following command:

sudo chmod 644 /etc/resolv.conf

As a result, if the problem is caused by misconfiguration of user permissions, you should not anymore receive an error when pinging your target website.

3. Check DNS Server Response

You should use nslookup or dig command to check the DNS server performance status. These command line tools are used to query the DNS server and check the answers for the desired domain. As a result, you can check whether it resolves to an IP address or not. For example:


As a result, the nslookup command allows you to search the DNS database through any computer on the network and find the IP address of a device by specifying the hostname. In addition, using this command, you can obtain the IP address of the destination host and the name and address of the main DNS server of the local network, and in this way, you will be sure of the correct configuration of the hostname. Learning how to use the nslookup command will help you a lot in diagnosing the correct operation of the DNS server and fixing DNS troubleshooting.

4. Test with a Different DNS Server

The DNS server may be inside your local network, or you may use the ISP DNS server. The DNS server the user uses may not recognize the corresponding IP address. Your DNS can be the Active Directory of your local DNS server or your ISP DNS server. If you are using your own ISP’s DNS servers, you can temporarily switch public DNS resolvers like Google DNS (, or Cloudflare DNS (, to identify your problem and troubleshoot ‘temporary failure in name resolution’ error.

5. Check Firewall and Security Software

Another common reason why you see the DNS resolution failed error in linux ubuntu is that DNS requests are blocked by firewalls or security software. Therefore, you must ensure that DNS traffic is allowed through the firewall and any security software. For this, you should temporarily disable the firewall and other security software, even SELinux (Security-Enhanced Linux) or AppArmor, and check whether the name resolution problem is solved. If the problem is local DNS filters or firewalls blocking DNS queries, you should reconfigure the firewall settings and other security software.

To reconfigure the firewall, first, check the firewall filter rules for ports (used for whois lookup) 43 and (used for DNS – Domain Name Resolution) 53. If you find that ports 43 and 53 are blocked in the firewall of your Linux system, you should allow them. Since most Linux distributions, such as Debian and Ubuntu, use the UFW firewall by default, run the following command to open ports 43 and 53 in the UFW firewall in Debian-based distributions:

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

To apply changes to the UFW firewall rules, reload the firewall:

sudo ufw reload

If you are using RHEL and CentOS distributions whose default firewall is Firewalld, run the following commands to open ports 43 and 53 in Firewalld:

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

6. Flush DNS Cache

Flush DNS Cache in a Linux system is one solution worth trying to solve the “Temporary failure in name resolution” error. Flush DNS Cache in linux clears any outdated DNS entries; For this purpose, run the following command:

sudo systemd-resolve --flush-caches

7. Check /etc/nsswitch.conf

One way to solve this problem is to check the /etc/nsswitch.conf file to ensure that DNS lookups are enabled. For this, you need to open the /etc/nsswitch.conf file and make sure that the hosts line contains “dns”:

hosts: files dns

8. Restart the DNS Service

To ensure that the DNS service is running correctly, restart the DNS service using the following command:

sudo systemctl restart systemd-resolved     (systemd-based distributions)
sudo service network restart     (init-based distributions)

9. Check DNS Server Logs

If none of the previous solutions solve the name resolution issue, check the DNS server logs (if applicable) to diagnose and resolve DNS-related errors and problems.


This article mentioned the causes of the displaying “Temporary failure in name resolution” error, and 9 common methods of troubleshooting and fixing dns resolution error in linux were taught. The Best Tools for Troubleshooting DNS Issues article will guide you more on diagnosing and troubleshooting DNS issues. We hope that your problem has been solved by reading this article. If you have experienced a solution that is not mentioned in this article, we will be happy to share your experience with us and suggest a new solution.

Leave a Reply

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