0

I have an Ubuntu VPS which is accessible. Also, I have a local Windows PC which is not, because of NAT.

What I want to do, but am struggling with:

I want that all traffic to certain port to the VPS be redirected (maybe through the SSH connection I can make from the local Windows PC to the VPS) to the local PC, making the server I run on said PC reachable from others in the Internet.

Most guides on the web regarding this matter are meant for SSH connection tunneling and only between linux devices. Can someone lend me a hand to pull this in the scenario described? Thanks!

2
  • Sounds like an XY problem to me. Why not configure port forwarding in your router?
    – Panki
    Mar 26, 2020 at 13:12
  • Hello, Panki, I can't port forward from my local PC because it's behind a Double NAT, my public IP is shared.
    – Chembs
    Mar 27, 2020 at 12:34

1 Answer 1

0

If port forwarding is not an option, the only thing I can think of is SSH remote port forwarding, which is fairly straightforward.

ssh -R <PORT_ON_VPS>:127.0.0.1:<PORT_ON_HOME_SERVER> <VPS_IP>

So, for example, if you run a web server on your home server on port 80, and would like that to be accessible via the VPS, you could connect to your VPS from your home server using ssh -R 8080:127.0.0.1:80 <VPS_IP>. Then, http://VPS_IP:8080 would reach your web server on your home server. See more about this option here.

That being said, SSH is not exactly the fastest thing in the world, and I don't recommend this setup in a production environment. The use case for the above would be more to share an application temporarily so someone could access it from the outside for demonstration purposes.

2
  • Hello hakasapl I managed to suceed doing the procedure you described for port 80 in my localhost, I used XAMPP to test. I could reach the webserver. However, I had no such luck doing the same for port 19132 in a local minecraft server. Maybe it's a limitation of such technique?
    – Chembs
    Mar 30, 2020 at 3:03
  • Shouldn't be an issue. Minecraft runs a TCP port just like a web server does, so assuming you have the correct port it should work fine. In this case you wouldn't have to worry about a firewall since SSH will bypass it.
    – hakasapl
    Mar 31, 2020 at 17:48

You must log in to answer this question.

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