Introduction
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.
Prerequisites
- Sudo or root privileges.
- A working internet connection.
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:
ping phoenixnap.com
The system cannot communicate with the DNS server and returns the error:
“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:
nameserver 8.8.8.8
Add at least one if you do not have a nameserver listed in the file. 8.8.8.8
and 8.8.4.4
are the popular nameservers owned by Google, but you can add any functional DNS server to this list.
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:
ping phoenixnap.com
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.
ping phoenixnap.com
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.
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.
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
.
2. Repeat the command for port 53.
sudo firewall-cmd --add-port=53/tcp --permanent
3. Reload the firewall.
sudo firewall-cmd --reload
4. Test the connection by pinging a website.
ping phoenixnap.com
Note: Check out our post on DNS troubleshooting as well.
Conclusion
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.
Đăng ký liền tay Nhận Ngay Bài Mới
Subscribe ngay
Cám ơn bạn đã đăng ký !
Lỗi đăng ký !
Add Comment