1

I want to setup a little game server to play on with my friends, I pay for a vps, but it just doesn't have the hardware to run this game server. My own pc could run the server, but opening ports to my pc from the outside internet isn't really an option for me.

So what would be ideal for me would be to forward a port from my pc, through my vps, but I don't really have any networking knowledge and information I found online is pretty confusing to me.

As far as I understand, it might be possible through ssh?

I saw that this person was doing something similar: How to forward a port from one machine to another?

Though, I am a bit confused about the awnser that question got. It mentions doing:

ssh -L 2222:localhost:8888 -N -o GatewayPorts=yes hostname-of-M

In the question, M is supposed to be the main machine, and S the machine server through which the traffic should be routed. The person anwsering mentions: "You can use localhost instead of M" which makes me think that you are supposed to run this command from machine M

But if M is localhost, then where in this command are you actually connecting to S?

I tried using the ip of my vps instead of "hostname-of-M" but that doesn't seem to do much.

So that is where I am at, I think it should be possible through ssh? But I am not entirely sure of that? Is this ssh stuff only possible if M's ip is visible from S, and should I then be running the ssh command from S?. I am just very confused about what this command is supposed to be doing exactly. So... Am I even on the right track here but just missing a step? or do I need a totally different approach?

2 Answers 2

1

I have tried one thing I hope you can try it too. I have installed OpenVPN server on VPS which have an public IP and connected my local machine to VPN server. In this case

VPS Public IP: x.x.x.x
VPS Internal Openvpn tunnel IP: 10.8.0.1
Local machine Openvpn tunnel IP: 10.8.0.2

fired up python3 -m http.server on local machine which servers http server on port 8000.

On vps server ran ssh -L 8080:10.8.0.2:8000 -N -o GatewayPorts=yes [email protected] and boom !! So from now any request comes to port 8080 will be forwarded to my local machine on port 8000.

I can connect to my local machine from internet using VPS public IP x.x.x.x:8080

1
  • Awesome, that works
    – TT-392
    Feb 20, 2022 at 12:01
0

I'm sorry if my answer turns out to be off topic, but since your goal is to expose your home PC to the Internet, I was wondering - does it really have to be forwarded via your VPS?

In case doing it via an external service would also be a viable option, you could try ngrok instead - it's really easy to use, just download the binary and then, after running ./ngrok [protocol] [port_number] you'll get a server URL like [hash].ngrok.io you share with your friends (At the very least, on Stack Overflow there seem to be people playing Minecraft like this)

Do note, however, that the US server location might turn out to be suboptimal for you and your friends (in the worst case, perhaps even making the game unplayable, if it's latency sensitive) - optionally, you could try to choose the closest one with the -region option as described in the above SO link (check the docs for a detailed region list)

You must log in to answer this question.

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