Skip to content
Log In Sign Up info@muvcloud.com

What the Message Means

The connect call failed with EHOSTUNREACH. Either a router or firewall sent back an ICMP "unreachable" message, or the target is on the same subnet and never answered the ARP request that asks for its hardware address. You see it in many tools:

ssh: connect to host 203.0.113.10 port 22: No route to host
nc: connect to 203.0.113.10 port 8080 (tcp) failed: No route to host

The nc line is from the OpenBSD netcat of Debian and Ubuntu; the ncat-based nc on AlmaLinux and Rocky Linux words it differently. curl reports it as a failure to connect, with the same reason at the end.

Refused, Timed Out, or No Route?

MessageWhat came backUsual cause
RefusedA TCP resetNothing listens
Timed outNothingA firewall drops
No routeICMP, or no ARP answerA firewall rejects, host down

The other two cases are covered in SSH connection refused and SSH connection timed out.

Cause 1: A Firewall Rejects the Port

firewalld on AlmaLinux and Rocky Linux, in its usual setup, rejects traffic to ports that are not open with an ICMP "host prohibited" answer, which a Linux client reports as no route to host. The server is up, and ping may even work, because ping is allowed. List what is open:

sudo firewall-cmd --list-all

Open the port you need, then reload:

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

For a known service, use --add-service=http instead. Rules written directly with iptables can do the same with REJECT --reject-with icmp-host-prohibited; sudo iptables -S | grep REJECT lists them. See firewalld basics and the iptables tutorial.

Cause 2: The Host Is Down or the Address Is Wrong

For an address on the same subnet, the kernel first asks for its hardware address with ARP. No answer means no connection, reported as no route to host. Check the neighbor table:

ip neigh show 203.0.113.10

FAILED or INCOMPLETE means the host did not answer. Check the address for typos, and check that the server is running in your provider's control panel and its console.

Cause 3: Routing and the Gateway

ip route
ip route get 203.0.113.10

The second command shows which gateway and interface the kernel would use. If there is no matching route at all, Linux usually reports "Network is unreachable" instead. If the route exists but the gateway does not answer ARP, you get no route to host. See what is a default gateway and the ip command.

Cause 4: A Firewall Elsewhere

A router or a network firewall between you and the server can also send ICMP unreachable messages. A TCP traceroute to the port shows where the path stops:

sudo traceroute -T -p 22 203.0.113.10

If it stops before the server, check any firewall in your provider's control panel, and check with your provider about filtering in their network. More in traceroute and mtr.

Step-by-Step Check

  1. From the client: ping 203.0.113.10, then nc -vz 203.0.113.10 8080.
  2. On the server: sudo ss -ltnp to confirm the service listens on that port and on the right address; see the ss command.
  3. On the server: list the firewall rules and open the port.
  4. On the server: sudo tcpdump -ni any 'tcp port 8080' while the client connects, to see whether the packets arrive.
  5. If nothing arrives, look at the route and at firewalls along the way.

Keep an SSH session open while you change firewall rules, and test in a second one, so a mistake does not lock you out.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations