-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?

9
  • 4
    Does this answer your question? How to access home ssh server from outside via the Internet?
    – user68186
    Commented Oct 23, 2021 at 13:45
  • @guiverc no, these are desktop systems for home use
    – Daniel
    Commented Oct 23, 2021 at 13:53
  • @guiverc it's 20.04, i'm not aware of ubuntu/linux version conventions. I don't think it matters, though
    – Daniel
    Commented Oct 23, 2021 at 13:56
  • @user68186 the no, i don't see much in common between these questions. I don't understand how to find route between these PCs and how to use it for ssh setup
    – Daniel
    Commented Oct 23, 2021 at 14:00
  • If there is no way to access them by IPs, you'll need a third ssh server, accessible to both, and then user reverse ssh tunnel. Commented Oct 23, 2021 at 14:05

2 Answers 2

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.
1
  • Thanks. Could you, please, enclose some tutorials on how to set up ddns or some free ddns services, if you know them.
    – Daniel
    Commented Oct 23, 2021 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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .