1

I can't ssh into my home server outside of my home connection.
(Notice that connected to my wifi, the same which is connected my server, and ssh into my server's local ip I've success).

On my server runs Ubuntu 20.04 (stable version) and the current SSH version is "OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022" and It runs on port 22(as default setting). I allow the port 22 from Anywhere in ufw setting and I apply it. On my router settings I set port mapping rule the forward the request on port 2200 to my local server throw MAC address(I've read that Ip may change) of my server on port 22(the port upon which runs ssh service).

This are my router map settings: My router settings;

Here there is a translation: "abilitato" -> "enable" , "Qualsiasi host tutte le interfacce" -> "Any host all interfaces"

When I try to ssh with ssh my_user@my_router_ip -p 2200 in my terminal (I tried with macOS terminal and WebSsh on iPadOS) the request starts but after a few minutes ssh fails with a timeout error.

What I'm doing wrong? Thank you

Danatela
  • 13,384

1 Answers1

1

My_router_ip is your local address (192.168...) which is unreachable from the outside.

The outside IP address is set by your provider and usually changed after 24h.

So you you have to find out your "external" ip address first - which is not really feasible given you are not at home.

You should use a dynamic DNS service (look for a Dynamic-DNS-Service in your country) that connects with your box (a "Fritzbox" has a DynDNS setting). You'll get an url which will ma to your external IP and your ssh should look like this:

ssh my_user@someDynsName -p 2200 

You should be aware that you'll open your firewall to the world. Make sure the receiver of the open port is hardened.

More infos from help.ubuntu

kanehekili
  • 7,426