In the case of a remote host, users encounter this error due to an offline or non-responding host, permissions/firewall issue, or in some rare cases, DNS resolution.We’ve detailed the probable causes and ways to resolve this error in both scenarios in this article.
How to Fix No Route To Host
We recommend starting with basic troubleshooting steps like checking the status of the host server.
Check Host Status
It may seem obvious, but you should first ping the remote host and make sure it’s actually online. If you can ping the IP but not the hostname, the error is most likely due to a DNS issue. In such cases, use sudo nano /etc/systemd/resolved.conf and change the DNS address.If you have access to the host, run the sudo systemctl status
Configure Firewall
Before fiddling with the firewall, it’s worth confirming that you’re actually trying to connect to the correct port with sudo nmap -sS
Create Ingress Rule
In the case of Virtual Cloud Networks (VCN), you’ll have to add an ingress rule to your subnet to make your VM accessible from the internet. When creating the rule, use the following values:
Check Routing Table
You may also be encountering this error due to issues with the host’s routing table. You can use netstat -rn to display the routing table and check if anything is off. For instance, one user found that one of the entries was incorrect.Upon checking /etc/network/interfaces, he found that one of the interfaces had two IP addresses, but they were both public-facing. Adding the correct netmask to one of the addresses resolved the routing issue.