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 sudoreliable internet accessWhen a user uses a command like “ping” to connect to a website, an error occurs:
Ping www.arzhost.comThe 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.
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 sudoEnsure 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 systemctlThe aforementioned command outputs nothing if it is successful. Pinging a website will show whether your new name servers are configured properly:
Ping www.arzhost.comYour DNS server is operational if you can observe data being sent and received using the ping command.
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.confRe-ping a webpage.
Ping www.arzhost.comThe scripts above correctly fix the fault if incorrect file permissions were to blame.
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 lookupthe domain name resolution port 53To allow traffic on port 43 using the UFW firewall, enter the following command:
ufw allow 43/tcp sudoThe rule has been successfully amended, according to UFW.
For port 53, repeat the command.
ufw allow 53/tcp sudoUse the following command to reload UFW:
ufw sudo reloadThe outcome validates the operation’s success.
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 —permanentfirewalld prints “success” as its output.
For port 53, repeat the command.
the command sudo firewall-cmd —add-port=53/tcp —permanentFirewall reloading
Firewall-cmd —reload with sudoPinging a webpage will check the connection.
Ping www.arzhost.comThis 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.