How do I port forward local Minecraft server through a separate server that I have?
I don't even know how to google what I'm trying to do, but here is the gist of it:
I have a local server running on my computer 127.0.0.1:25565 and I have a separate server that I use for WireGuard and which I have access too
How do I use that server so that other people can join the Minecraft server through it?
ATM I'm using playit.gg and it works good... most of the time, by which I mean that it drops connections for people randomly
(I also have bluemap working and I'd like to know if I can use that too)
17 Replies
Wheres that other server from?
It's from a hosting provider
The server is situated in france
Yeah what hosting provider
oh, it's aeza.net
Playit could still give a better experience overall
What do you mean?
Because it's easier to set up?
no because they have way better machines with better uplinks located across the world anycasted
And aeza's tcp mitigation is a bit weird so it may also kick players
To forward a port from your WireGuard VPN server's public IP to a client (VPN peer), you'll need to configure iptables or firewalld on the VPN server to perform port forwarding (NAT rules).
---
Steps to Forward a Port from the VPN Server to a WireGuard Client
1. Enable IP Forwarding on the VPN Server
Ensure that the VPN server allows forwarding traffic between interfaces.
Run:
---
2. Set Up an iptables Rule for Port Forwarding
Assume:
- The VPN server's public IP is
1.2.3.4
- The WireGuard interface is wg0
- The client has the internal VPN IP 10.0.0.2
- You want to forward port 12345 (TCP) from the VPN server to the client
Run:
For UDP, change -p tcp
to -p udp
.
---
3. Allow Forwarding in iptables
If using firewalld instead of iptables:
---
4. Persist iptables Rules
To keep the rules after a reboot, save them:
To restore them on boot, add this line to /etc/rc.local
or use a systemd service.
---
5. Configure the Client (10.0.0.2)
Make sure the service listening on port 12345
on the WireGuard client is properly configured to accept traffic from 10.0.0.1
(server).
---
Testing the Port Forwarding
From any external machine, try:
If it's UDP:
On the client (10.0.0.2
), you can run:
or
If it works, external connections to 1.2.3.4:12345
will be forwarded to 10.0.0.2:12345
over WireGuard.
---
Bonus: Debugging
If it doesn't work, check:
- WireGuard status (wg show
)
- iptables rules (sudo iptables -t nat -L -v -n
)
- Firewall logs (sudo dmesg | grep DROP
)
Let me know if you need adjustments for your setup! 🚀Alright, I'm gonna try this tomorrow, now is a bit late, thanks
Welp, didn't work
I checked and I have the connection
honestly, just run velocity https://papermc.io/software/velocity on the vps (for bluemap, you might also need to run nginx, haproxy, traefik or caddy)
PaperMC
Velocity
Velocity is the modern, high-performance Minecraft server proxy. Designed with performance and stability in mind, it’s a full alternative to Waterfall with its own plugin ecosystem.
Yeah... I figured, but still gave it a shot
Is it just a proxy that I install on the VPS?
yeah, it’s a proxy designed for minecraft
will allow multiple servers on the same port too
I see, that seems to be exactly what I need then, it seems to even support multiple ports
I'll check it out later, thank you!
He said he doesnt want a proxy because he can't port foward bruh
re-read that message I sent
You right, he never said he couldn't port foward
I just assumed based on what he explained
velocity works fine over a vpn
no need for port forwarding