Table of Contents
To fix network problems on Linux, you need to know how to fix ‘No Route to Host error’ issue on Linux. We’re here to help you figure out how to fix the mistake in this guide. “No route to host” is one of the last things you want to hear when you’re trying to connect to a service on Linux.
It’s a general message that means your computer can’t reach the target server, whether it’s a local server daemon running on your system or a remote server you can’t access for some reason. There are a lot of things that could cause that error. Networking in Linux is done through a complex stack, which makes it hard to figure out exactly where the problem is.
“No Route to Host” means that there is a problem with the network, usually because the server or host isn’t responding. This could happen if there are problems with the network or if the computer is not set up right. You can also go to the official Microsoft support site for more information about this error.
Ways to fix ‘No Route to Host error’ issue on Linux
Configure Firewall
Before tinkering with the firewall, it is worth checking with sudo nmap -sS to make sure you are actually trying to connect to the correct port.
Assuming the port is correct, it is recommended that you edit the firewall rules using iptables. The following command will allow the specified port on the firewall and save the changes to /etc/iptables/rules.v4
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport <portno> -j ACCEPT
sudo netfilter-persistent save
Check Host Status
This may be obvious, but first ping the remote host to verify that it is actually online.
If you can ping the IP but not the hostname, the error is most likely due to a DNS problem. If this is the case, use sudo nano /etc/systemd/resolved.conf to change the DNS address.
If the host is accessible, run the sudo systemctl status command to verify that the associated service is indeed running.
Assuming the host is online and the service is running, the error is most likely due to a permission issue. First, check /etc/hosts.allow and /etc/hosts.deny. If these configuration files are OK, it is best to troubleshoot the firewall problem.
Create Ingress Rule
For Virtual Cloud Networks (VCNs), an ingress rule must be added to the subnet to allow access to the VMs from the Internet. When creating the rule, use the following values
Source Type: CIDR Source CIDR: 0.0.0.0/0 IP Protocol: TCP Destination Port Range: 80
Check Routing Table
The error can also be due to a problem with the host’s routing table. netstat -rn can be used to view the routing table and see if anything is off. For example, one user found that one of the entries was incorrect.
A check of etc/network/interfaces shows that there are two IP addresses on one of the interfaces, both for the public. Adding the correct netmask to one of the addresses solved the routing problem.
FAQ
What does no route to host mean Linux?
No Route to Host” indicates a network problem and is usually displayed when the server or host is not responding. This can be due to network problems or improper configuration.
What is error 113 no route to host?
This is an error returned by the kernel, indicating a network problem: the UM library made a send() socket call, but the OS/kernel raised a code 113 error defined as EHOSTUNREACH (no route to the host), which is a possible This is a possible scenario.
What is no route to host Apache?
A TCP No Route To Host Error (often wrapped in a Java IOException) occurs when a machine on the network does not know how to send TCP packets to a given machine. Possible causes include the following The hostname of the remote machine is incorrect in the configuration file.
How to add route to host in Linux?
The easiest way to add a route in Linux is to follow the “ip route add” command, specifying the network address to be reached and the gateway to be used for this route. By default, if no network device is specified, the first network card, the local loopback, is excluded and selected.