EHOSTUNREACH
Linux / POSIXERRORNotableNetworkHIGH confidence

No Route to Host

What this means

The local routing table has no route to reach the destination host. This differs from ENETUNREACH in that the network itself might be reachable but the specific host address is not routable from this system.

Why it happens
  1. 1The destination IP address is on a network with no configured route.
  2. 2The host is on a private subnet not accessible from this network.
  3. 3An intermediate router returned ICMP host unreachable.
  4. 4VPN or tunnel is down and traffic cannot reach the remote host.
How to reproduce

Connecting to a host on a network with no configured route.

trigger — this will error
trigger — this will error
$ curl http://10.255.255.100/api
curl: (7) Failed to connect to 10.255.255.100 port 80: No route to host

expected output

curl: (7) Failed to connect to 10.255.255.100 port 80: No route to host

Fix

Add a route or reconnect the VPN

WHEN When accessing a host on a specific subnet

Add a route or reconnect the VPN
# Show current routing table
ip route show

# Add a route to the subnet
sudo ip route add 10.255.255.0/24 via 192.168.1.1

# Or reconnect the VPN that provides access to this subnet

Why this works

Adding a route tells the kernel how to reach the destination subnet, enabling TCP connections.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors