SSH Connection Error: No route to host
Solution 1:
The routes look fine. I'll assume that those IP addresses are private ones (LAN) and not public accessible.
Since you're connected in different ways to the network (wifi / wired), it's very likely that your router has separated wired / wireless networks. Try connecting both of them on a wired (or wireless) connection. Another possibility is that a firewall on the Ubuntu machines is blocking connections.
Otherwise, configure your router to use the same network (subnet) for wireless and wired connections. Also make sure that the router does not block client-to-client communication.
Your router is possibly dropping all unsolicited packets, that's why your friend gets a "connection timed out" message on your public IP address. Configure NAT port forwarding so that the public IP address + port combination forwards to your LAN address.
Example network:
YOUR NETWORK (A)
Router A (public address: 198.51.100.1)
Desktop A - 10.0.0.2
Laptop A - 10.0.0.3
YOUR FRIENDS NETWORK (B)
Router B (public address: 203.0.113.1)
Machine B - 192.168.0.2
On Router A, setup NAT forwarding:
To make your desktop accessible:
forward the public port 22 to 10.0.0.2
To make your laptop accessible:
forward the public port 2222 to 10.0.0.3
If you've a firewall (ufw
, iptables
, ...) on the machines set, allow incoming traffic to port 22 (Desktop A) and port 2222 (Laptop A).
The desktop can now be accessed using SSH with:
ssh [email protected] -p 22
The laptop can now be accessed using SSH with:
ssh [email protected] -p 2222
If you want to access your friends machine, apply these instructions to his machine + router.
Solution 2:
i had a similar problem. One machine on wire one wireless. I found a tickbox in my router besides "seperate ips for lan and wlan" and ticked it off. Now i can login to the wireles computer. Before that i got the error message "No route to host".
Solution 3:
Check the ssh check box while installing RHEL. I did not check it and causing the same issue. Please check that parameter