Got stuck by the error ‘wget failed no route to host’ while installing a new piece of software?
wget is a Linux command that helps to download files from the web.
Often ‘wget failed no route to host’ refers to a network connection error or unresponsive server.
At Bobcares, we receive requests to fix wget errors as part of our Service Management Services.
Today, let’s see the causes for Wget error and how our Support Engineers fix it.
What causes wget failed no route to host error?
We’ll first check on how the error appears while executing wget command. For instance, we one of our customers tried to install a software, the following error appeared.
Let’s now check the few reasons that trigger the error ‘wget failed no route to host’.
1. Server down
For any command to execute, the server must be up and running. The same goes for the wget command as well.
If the server is not responding or any other critical error in it then the wget command will display an error.
2. Port unavailability
Similarly, port unavailability can also be a reason for wget errors.
A port is a communication endpoint. Sometimes, few customization in the iptables will disable certain ports on the server. This causes errors while executing wget command.
The port number 80 is necessary for making internet communication for wget to work well. So, disabling this port ends up in an error.
3. Firewall block
Firewall block is one of the most common reasons for wget errors.
If there is any block set in the server by a firewall, then there are a lot of chances for the wget command not to work. In other words, a firewall filters most of the unwanted connections. Thus, the wget command failed to work.
4. DNS error
When the website DNS is not resolving properly, then also wget command will throw an error.
If you are trying to wget the contents from a non-resolving website, then wget cannot fetch the contents and it ends up in failure.
So it is very much important for the hostname of the website to be resolving well.
How we fix wget failed no route to host error?
We just saw the major reasons for the wget failed no route host error message to occur. Let’s now see how our Support Engineers fix the error message.
Recently, one of our customers got the below error message while trying to wget a website.
$ wget example.com
--2019-06-20 00:11:26-- http://example.com/
Resolving example.com (example.com)... x.x.x.x.x
Connecting to example.com (example.com)|x.x.x.x.x|:80... failed: No route to host.
Our Support Engineers started to troubleshoot by checking the server availability.
We initially executed the below command.
ping x.x.x.x
Here, the server was working well. So we went checking if there is any error in DNS propagation. And the DNS was also fine.
Further, we checked the server firewall to see if there is an IP block.
iptables -L INPUT -v -n | grep x.x.x.x
However, there was no block for the IP on the server.
Further, we checked for the port restrictions using :
netstat -plunt | grep 80
This confirmed that port 80 was not active in the server. So we used the below command to enable the port 80.
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
Finally, this fixed the error and wget started working.
[Need help in fixing the wget errors? We’ll help you.]
Conclusion
In short, the wget failed no route host error is mainly caused due to the firewall blockage, port restrictions or offline remote server. Today, we saw the major reasons for the wget errors and how our Support Engineers fix it.
Hi, i did the steps, but its doesent works.. i wanted to download a file(wordpress) with wget cmd on my ubuntu server, and its answers : failed: No route to host… : root@weblerszo:~/Downloads# wget https://hu.wordpress.org/latest-hu_HU.tar.gz
–2023-01-19 00:01:05– https://hu.wordpress.org/latest-hu_HU.tar.gz
Resolving hu.wordpress.org (hu.wordpress.org)… (myIP).
Connecting to hu.wordpress.org (hu.wordpress.org)|(myIP)… failed: No route to host.
root@weblerszo:~/Downloads#
when i tried the : netstat -plunt | grep 80
tcp6 0 0 :::80 :::* LISTEN 765/apache2
udp6 0 0 fe80::a00:27ff:fe78:546 :::* 693/systemd-network
i need to allow the udp6? or what? Thanks for the help
i work in cmd.
Hi,
Our experts can help you with the issue.we will be happy to talk to you through our live chat(click on the icon at right-bottom).