-1

Suppose I have 2 PCs running linux (say, Ubuntu 20.04). One of them is mine, other one belongs to a person who lives in another city district.

These are ordinary PCs: they both access Internet through local provider's network, so you can't access them by IP address solely.

How could I set up routing on these two PCs to be able to connect via ssh?

Daniel
  • 1

2 Answers2

0

B (ssh server) must transmit to A (ssh client) B's current IP address. Then ssh will work.

There are many ways: Phone, email, website.

One of the most common automated methods is DDNS (Dynamic DNS). DDNS services will associate a constant name (B.ddns.net) and keep it up to date with with B's ever-changing IP address. B must run a small service that occasionally updates the DDNS provider. Many free DDNS services are available.

So A need merely ssh b.ddns.net to connect to B.

  • Of course, this assumes that B is also port forwarding ssh connections on ther router properly, that B has configured their SSH server properly, and that B is properly using a adequately secure based method of authentication (not passwords) for an ssh server connected to the internet.
user535733
  • 62,253
  • Thanks. Could you, please, enclose some tutorials on how to set up ddns or some free ddns services, if you know them. – Daniel Oct 23 '21 at 14:17
0

Think of the servers like a phone that can only make outbound calls. No one can call in, but you can call out. The two servers can't talk to each other without help from a third server that can take incoming calls. That said, where can you get a third server on the internet to connect the two outbound PC's?

https://portmap.io/ provides a free solution to allow a server behind a firewall or NAT to have one port accessible from the internet. This requires the server to maintain an openVPN connection to portmap.io

Continuing with the phone analogy, you make a connection to portmap.io, they give you your own domain (and port), and you can get incoming calls as long you stay connected. From the internet, portmap.io takes an incoming connection on your domain/port, and forwards the audio/data to your extension if you're connected.

You need to be aware of the security and privacy implications of this solution before implementing it. Good luck!

VXDguy
  • 191