6

Hope you are doing well today!

I started using Linux a few months ago and am pretty much new into Linux and networking.

I am using Ubuntu 20.04 2.0 LTS and installed kubuntu on a friend of mine a couple of weeks ago.

I was with 20.04 recently but decided to upgrade to 2.0. My SSH was working just perfect before upgrading the distro, but now it's not connecting anymore.

I was able to connect from my phone to my laptop with SSH before, but not anymore. I also cannot connect from my laptop to other devices using SSH. My friend and I want me to get into his server using SSH, but when I try to connect to him, I receive the following as an output: ssh: connect to host port 22: No route to host

After receiving the error above, I tried to ping his network just to make sure it's working and received the following after pinging: Destination Host Unreachable

Is the issue on my side or does he need to do any configs on his side?

Any assistance would be appreciated!

Thank you for your time!

  • In your question, show an attempt to ping a known good address, like 1.1.1.1 – user535733 Mar 17 '21 at 21:00
  • @user535733 yes, it's pinging. I can ping my network as well – space_cadett Mar 17 '21 at 21:17
  • but can't ssh be used between external networks? – space_cadett Mar 17 '21 at 22:25
  • 2
    SSH can be used between external networks if there's a route between them - in particular, if your friend's server is behind a NAT router, then you must use their router's public IP as the destination address, and they must forward a port for SSH across the router. – steeldriver Mar 17 '21 at 23:29

2 Answers2

2

you have a connectivity problem that is why you get the message "Destination Host Unreachable". Also the message "no route to host" points to the same problem, you internet connectivity. ping google.com or 8.8.8.8 to make sure your connectivity is Ok, if it works then you can check your friend's IP address is Ok or whether ssh connectivity is allowed on port 22 of his device. That is the little I know, hope it helps in finding a solution

Tubu21
  • 41
1

No route to host is a common new-ssh-user network error.

  1. Simplify: Test that your ssh client can connect to the server on the same local network. This is how you test that the ssh server is working properly, and how you best troubleshoot problems with logins, passwords, and keys.

    Once you can connect on the LAN, stop making changes to the server! Everything after this point is networking that is done on the client or the router. Don't break your server.

  2. Test that your remote ssh client has connectivity. You should be able to ping a known working server on the internet. (Example: ping -c4 8.8.8.8).

  3. Most amateur and household local networks use a router to connect to the wider internet.

    The WAN IP is really the router IP address.

    Test that your remote ssh client can ping the ssh server's router. Since the ssh server is behind a router, you won't be able to ping the server directly.

  4. Set up port forwarding on the server's router. This require logging into the router and changing it's settings. Inbound ssh packets on port 22 (or whatever port you choose) must be forwarded to the server's LAN IP address. Make NO changes to the client's router.

  5. On your remote ssh client, connect using the WAN IP address, not the LAN IP address:

    ssh -p 22 me@205.124.456.789

  6. Household WAN IP addresses change. If you still get no route to host, then double check your ssh server's LAN and WAN IP addresses.

  7. Some ISPs block port 22. Try using a different port. Remember to change the listening port on the router, not on the server.

user535733
  • 62,253
  • Thank you all for the time and effort given to me! As well as for the detailed explanation. I have a couple of questions if may I ask. How can I connect to another port, but not 22 with SSH? Also, what is the difference between the LAN and WAN IPs? I mean, when and why one of the two should be used? I apologize for asking, but am pretty new into networking and still googling a lot of stuff and is a mess tbh – space_cadett Mar 18 '21 at 19:53
  • Thank you very much for clearing things out! – space_cadett Mar 18 '21 at 20:40