How Do You Solve The “No route to host” Error When You Try To Use The wget Command?

Problem scenario:  You can ping a web server, but you cannot use the "wget http://www.continualintegration.com" command (with no quotes and where www.continualintegration.com is the URL or IP address of the web server).  You get the error result "No route to host."  How do you use wget to retrieve the files on the web server?

Solution: Try one of these four diagnostic methods to isolate the problem:

  1. Verify the firewall is not blocking web requests on the Apache server.  Use "ps -ef | grep firewalld" with no quotes to see if it is running.  If it is running, and you are in a situation where you can afford to turn it off, turn it off with "service firewalld stop" or "systemctl stop firewalld". 
  2. See if there is an intermediate proxy server or firewall between the two servers.  Use traceroute or some other network tool. 
  3. Use nmap -p 80 x.x.x.x (where x.x.x.x is the IP address of the Apache server). 
  4. Use "route -n" on the requesting server (the one you were issuing the wget command from).  The results will let you see if there is a default gateway, a subnet mask, and an IP address on your server.  If you are not receiving these, the problem should probably be solved by reconfiguring the network interface card correctly.

Leave a comment

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