When a website name cannot be converted into an IP address, the system generates the “EAI_AGAIN Temporary Failure in Name Resolution” error. There are numerous reasons why the issue could appear on your machine, even though it can occasionally be caused by a lost internet connection.
You can follow the instructions in this tutorial to troubleshoot and resolve the “EAI_AGAIN Temporary Failure in Name Resolution” error:
root privileges or sudo
reliable internet access
When a user uses a command like “ping” to connect to a website, an error occurs:
Ping www.arzhost.com
The system produces an error because it cannot communicate with the DNS server.
Resolv. conf network configuration file issues and firewall configuration issues are the most frequent causes of this error.
Below are the methods to correct the problem in both scenarios.
Method 1: A resolv. conf configuration error Linux systems’
resolv. conf file is used to set up DNS servers.
Start by launching the file in a text editor like nano.
nano /etc/resolv.conf with sudo
Ensure that there is at least one name server in the resolv.conf file. The lines listing name servers ought to appear as follows:
8.8.8 is a name server.
Add at least one name server to the file if you don’t already have one. Although Google owns the well-known name servers 8.8.8.8 and 8.8.4.4, any working DNS server can be added to this list.
Save the file, then shut it down.
Restart the DNS resolver service after that.
restart systemd-resolved. Service with sudo systemctl
The aforementioned command outputs nothing if it is successful. Pinging a website will show whether your new name servers are configured properly:
Ping www.arzhost.com
Your DNS server is operational if you can observe data being sent and received using the ping command.
Incorrect permissions
If the error still occurs even when your resolv. conf file has the correct DNS servers. It can be caused by improperly set file permissions.
Use the following command to give the root user ownership of the file:
/etc/resolv.conf chown root: root with sudo.
Change the user permissions to allow everyone to read the file on the system:
Doing sudo chmod 644 on /etc/resolv.conf
Re-ping a webpage.
Ping www.arzhost.com
The scripts above correctly fix the fault if incorrect file permissions were to blame.
Method 2: Firewall Limitations
A firewall blocking either one or both of the following ports could be another explanation for the “EAI_AGAIN Temporary Failure in Name Resolution” error:
using port 43 for Whois lookup
the domain name resolution port 53
1: Open the port in UFW Firewall
To allow traffic on port 43 using the UFW firewall, enter the following command:
ufw allow 43/tcp sudo
The rule has been successfully amended, according to UFW.
For port 53, repeat the command.
ufw allow 53/tcp sudo
Use the following command to reload UFW:
ufw sudo reload
The outcome validates the operation’s success.
2: Firewalld ports should be opened.
The default firewall in certain Linux distributions, including CentOS, is firewalld. In firewalld, the syntax is as follows:
the command sudo firewall-cmd —add-port=43/tcp —permanent
firewalld prints “success” as its output.
For port 53, repeat the command.
the command sudo firewall-cmd —add-port=53/tcp —permanent
Firewall reloading
Firewall-cmd —reload with sudo
Pinging a webpage will check the connection.
Ping www.arzhost.com
Conclusion
This article offered solutions for troubleshooting and resolving Linux’s “EAI_AGAIN Temporary Failure in Name Resolution” problem.
Visit Arzhost and read How to Use Linux dig Command for further information on troubleshooting DNS-related issues.