Ubuntu – SSH to local ip in external network

networkingopensshssh

I know there is a lot of information about this subject but still I do not understand something.
We have internal wiifi network that include 4 desktops, each one has internal local ip address.
The router get external static ip addres .
I want to connect from my home laptop (different network) to each one of these desktop by their local ip users and passwords.
I understand how to create port forwarding from my router, but I want to keep it dynamic and connect by ssh to diferent desktop each time…
How can I do it?
There is any command similar to ssh username@local-ip external-ip ?

Best Answer

You can specify port forwarding for incoming ports to forward to port 22 on each of the computers.

Say you have 4 computers on this network. We will call them A, B, C, and D. You have a laptop on a different network and you want to connect to computer A, B, C, or D.

Set incoming port forward on port 55555, for example, to forward to computer A on port 22.

To connect to computer A on port 22, you would connect to the external IP on port 55555 which will forward to computer A on port 22. The command to connect would read like so:

ssh username@externalIP:55555

example:

ssh holymoses@123.456.78:55555

Set up to forward all incoming connections on port 55556 to computer B, port 22 and so on and so forth.

Related Question