Created
September 15, 2021 19:41
-
-
Save mishailovic/31e006b5e59d88d032ddd6a2da08ef9a to your computer and use it in GitHub Desktop.
Expose your localhost if you are running your server behind NAT.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What you will need: Server behind NAT (Server A), Server with static ip e.g. VPS for hosting Wireguard (Server B). | |
1) On your server B paste this commands in terminal: curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh && chmod +x wireguard-install.sh && ./wireguard-install.sh | |
2) Create new client and save his ip. Mine will be 10.66.66.123 | |
3) Download this config to server A and connect to your server B with wireguard. | |
4) Depending on your client ip which we configured in step 2 type this commands in server B terminal (this time I wanted my Minecraft server exposed, so I chose 25565 port, yours can depends): | |
sudo iptables -P FORWARD DROP | |
sudo iptables -A FORWARD -i wg0 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A FORWARD -i eth0 -o wg0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A FORWARD -i eth0 -o wg0 -p tcp --syn --dport 25565 -m conntrack --ctstate NEW -j ACCEPT | |
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25565 -j DNAT --to-destination 10.66.66.123 | |
5) While you are connected to server B through the Wireguard, your Minecraft server proxied and can be accessible through your server B external ip. Good luck :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment