Linux 'No Route to Host' Network Error
About Linux 'No Route to Host' Network Error
Linux 'No route to host' error means the system has no network path to reach the destination, typically due to routing table or firewall issues. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: EHOSTUNREACH — the kernel has no route in its routing table for the destination. Different from 'Network unreachable' which means no route to the network. Can be caused by the remote host firewall rejecting with ICMP host-unreachable. The default gateway may be missing or unreachable. VPN routing conflicts can cause this for specific destinations. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Default gateway not configured or unreachable. Remote host firewall sending ICMP host-unreachable. Network interface down or not configured. Routing table missing entry for the destination network. VPN split-tunneling misconfiguration. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check routing table: ip route show — look for default via entry. Verify network interface is up: ip link show. Ping the gateway: ping -c 3 $(ip route | grep default | awk '{print $3}'). Add default route if missing: sudo ip route add default via GATEWAY_IP. Check if remote firewall is the cause: try from a different network. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
How is this different from 'Network unreachable'?
'No route to host' means the host specifically is unreachable (maybe firewall). 'Network unreachable' means the entire network has no route.
Overview
Linux 'No route to host' error means the system has no network path to reach the destination, typically due to routing table or firewall issues.
Key Details
- EHOSTUNREACH — the kernel has no route in its routing table for the destination
- Different from 'Network unreachable' which means no route to the network
- Can be caused by the remote host firewall rejecting with ICMP host-unreachable
- The default gateway may be missing or unreachable
- VPN routing conflicts can cause this for specific destinations
Common Causes
- Default gateway not configured or unreachable
- Remote host firewall sending ICMP host-unreachable
- Network interface down or not configured
- Routing table missing entry for the destination network
- VPN split-tunneling misconfiguration
Steps
- 1Check routing table: ip route show — look for default via entry
- 2Verify network interface is up: ip link show
- 3Ping the gateway: ping -c 3 $(ip route | grep default | awk '{print $3}')
- 4Add default route if missing: sudo ip route add default via GATEWAY_IP
- 5Check if remote firewall is the cause: try from a different network