Score:1

Connect to Server (it doesn't have external IP) over SSH

cn flag

I got a small PC setup as an Ubuntu server and I have configured ssh-server to be able to connect to it over ssh. The problem starts here because I have no external IP provided by my ISP, (all devices have 1 external IP) and I cannot change it. So based on research I did, I created a free tier AWS instance and I created OpenVPN there.

So I have a working it like that:

  1. PC1
  2. AWS Instance with external IP that hosts OpenVPN server
  3. PC2

PC1 and PC2 are connected to OpenVPN server on AWS and then I can connect to PC1 over SSH using PC2.
What are my options (if any) to connect to PC1 over SSH using PC2 without need of PC2 to be connected to OpenVPN or maybe there is some option to only connect to OpenVPN for ssh connection and the rest of traffic not to use openVPN?

cn flag
I suppose by "external IP" you mean a "static IP", correct?
cn flag
@AlexisWilke I mean like what I said, I have like 3-4 devices connected to my router (I cannot change any settings on that) and every of these devices have the same IP when I go to websites like "whatsmyip" so when for example I try to use that IP to connect to any of these devices over SSH, I cannot do it :(
cn flag
Oh... wow! You mean you have 2 PCs connected to the same router and you don't know how to SSH between the two?! Each PC has an IP address on the same network. You can just do `ip address` on a Linux system and then do `ssh <address>`. Usually that would be a 192.168.0.x IP automatically assigned by your router via DHCP.
cn flag
Why do you assume they are on the same network? Same router yes, same network no. ;)
cn flag
I don't know why you're complicating your life like this unless that's exactly what you want to achieve as a project. If you're just wanting to make it work, then put both computers on the same network and it will copy through the router at full speed. Another way to make it work with two networks is to add firewall redirections. But that's somewhat complicated. It's called [masquerading](https://linux.m2osw.com/how-setup-linux-firewall) (see the `FORWARD`, `PRE/POST-ROUTING`).
cn flag
Dude no offense, but i described the issue, I am not here to argue what the issue is about, but how to solve it and you telling me I don't have an issue is not a soluition at all
Score:0
cn flag

I don't know anything about OpenVPN. On my end, I use an SSH tunnel. The basics are pretty simple, but a complete setup can be somewhat difficult to do. That being said, you can have any number of computers tunneling (which is fast as long as you don't try to use all the tunnels at the same time).

ssh -fNR 2222:localhost:22 aws-computer

The aws-computer is a name in my ~/.ssh/config file which defines the key to use and user name / password.

Now when I ssh on my aws-computer I can use:

ssh -p 2222 pc1

and it connects as if I had a single/normal SSH connection.

You can repeat the tunneling as many times as you'd like which means, in the end, you can do one ssh pc2 from pc1 and one ssh pc1 from pc2. It's just a bit of setup to make it all work.

Host aws-computer
  HostName <ip-address-or-domain-name>
  User name
  Port 22
  PasswordAuthentication no
  HostbasedAuthentication no
  IdentitiesOnly yes
  IdentityFile /home/name/.ssh/tunnel_keys/tunnel_rsa

Note: I use a sub-directory for extra keys (keys other than my usual) so that way I can have any number of them.

The main limitation is that you need to use different ports (i.e. you can't have two services on one computer using one port). The other limitation is that one of the computers must have a static IP address or you need to make a Domain Name Server available which records the IPs. Such a DNS is not very secure since someone else could end up with "your" old IP and your systems may attempt to connect through a third party computer.

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.