Score:1

I can't ssh into my home server outside my home connection. Why?

ec flag

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

Score:1
zw flag

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

carbonedavidee avatar
ec flag
Where i can found my external ip and how i can open my firewall to the world?
kanehekili avatar
zw flag
As I said: depends on your external service which you have to choose and your router. There are many ways how to get your external IP (using dig, curl etc), But that's what this forum is for: it has millions of answers, you just need to look for them. Go to the searchbar above and type `display my public IP` and you'll find [this](https://askubuntu.com/a/1326106/906933)
carbonedavidee avatar
ec flag
I use No-Ip as DNS service and everything works. Thank you for the help
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.