Score:-1

Connect two PCs over Internet

br flag

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?

ar flag
Does this answer your question? [How to access home ssh server from outside via the Internet?](https://askubuntu.com/questions/1360840/how-to-access-home-ssh-server-from-outside-via-the-internet)
Daniel avatar
br flag
@guiverc no, these are desktop systems for home use
Daniel avatar
br flag
@guiverc it's 20.04, i'm not aware of ubuntu/linux version conventions. I don't think it matters, though
Daniel avatar
br flag
@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
hu flag
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.
ar flag
Please edit your question and provide more details. Can you use ssh with 2 PCs in the same home network? Do you know your internal and external IP addresses? Have you set up ddns? What errors do you get when you try to ssh?
Daniel avatar
br flag
@user68186 no, I haven't set up ddns. and I can't bring PCs together
ar flag
If your local internet provider uses NAT then you can't do it unless you can convince the provider to change their settings and set up port forwarding for you and your friend. In that case this question has nothing to do with Ubuntu.
ar flag
Add details about your internet setup. Is it broadband through cable, phone line?
Score:0
cn flag

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.
Daniel avatar
br flag
Thanks. Could you, please, enclose some tutorials on how to set up ddns or some free ddns services, if you know them.
Score:0
cn flag

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!

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.