SSH 'No route to host'
I've scoured the internet for a solution to my problem but I've so far had no luck. I'm currently trying to set up SSH on a clean Ubuntu 18.04 machine.
Running ssh returns
ssh: connect to host public.ip port 22: No route to hostRunning the same command with my private ip works.
I've never asked for help online before, always managed to find a social in another thread. However, this time I am completely stumped.
Edit 1- Sorry for initially poor information. Here's what I've currently tried. I've port-forwarded port 22. Doing so yields the no route to host response. Port-forwarding to another laptop yields the response connection refused. Removing port-forwarding to port 22 results in connection timed out.
I've tried turning off the UFW firewall, created exceptions for port 22 and it still yields the same response of no route to host.
Edit 2- So the purpose of what I'm attempting is to create a server for me to host a database and website on. So far, I've got most of the database set up through mysql and now need a server that can be accessed via SSH.
I' am able to ping my public IP address:
ping -c4 (ip)
PING (ip) (ip) 56(84) bytes of data.
64 bytes from ip: icmp_seq=1 ttl=64 time=2.96 ms
64 bytes from ip: icmp_seq=2 ttl=64 time=2.45 ms
64 bytes from ip: icmp_seq=3 ttl=64 time=2.53 ms
64 bytes from ip: icmp_seq=4 ttl=64 time=2.75 ms
--- ip ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 2.456/2.676/2.966/0.209 msI'm not sure what other information would be useful and I can't say for sure what is good and bad information to share. Suggestions for additional commands would be helpful! Please let me know if I need to clarify further (you can probably tell I'm a novice! :))
41 Answer
So either the target host is down or refusing connections to that port (eg. with iptables --reject-with), or you have some routing problems. You would be better off checking with tcpdump what is happening on the output interface of your ssh client.
You provided too little information on the server and client network configuration for a better guess.