Member-only story
How to troubleshoot “Failed to connect to xxx.xxx.xxx port xx: No route to host” error in a Linux machine like Fedora, RHEL, and Ubuntu
As you are trying to connect to an IP address/hostname with a curl, you might get an error similar to the following:
sh-4.4# curl xxx.xx.xx.xxx
curl: (7) Failed to connect to xxx.xx.xx.xxx port xx: No route to host
There can be few reasons why you might get an error message like above.
- Nothing is running on the hostname/IP address with the respective port.
- Firewall or other security is blocking for you to access
Let’s see how you can troubleshoot a problem like this.
PROBLEM SCENARIO #1: Nothing is running on the hostname/IP address with this respective port
In this case, if you have a sudo privilege for the server that exposes that particular IP address/hostname, try to run a command that shows ports that are in “LISTENING” status. In Fedora, for example, you can run a command like this: