Enable IPv4 forwarding at /etc/sysctl.conf
.
Install iptables-persistent and put this at /etc/iptables/rules.v4
.
*nat
-A PREROUTING -p tcp -m tcp --dport 25565 -j DNAT --to-destination 10.0.0.2:25565
-A POSTROUTING -o wg0 -j MASQUERADE
COMMIT
WireGuard VPS config
[Interface]
PrivateKey = <key>
Address = 10.0.0.1
ListenPort = 51820
[Peer]
#Minecraft Server
PublicKey = eIoLhKN17/G61DS7jO4GfsHihlm4s6fuED3Q5sgMgAM=
AllowedIPs = 10.0.0.2
WireGuard Minecraft Server config
[Interface]
PrivateKey = <key>
Address = 10.0.0.2
[Peer]
PublicKey = PVf10YXzSRq27kBOvUTA0uF7jDFtMgqWAoJEQRddyE0=
AllowedIPs = 10.0.0.1
Endpoint = <ip>:51820
PersistentKeepalive = 25