Hello!
The past few days im trying to set up a VPN tunnel (with wireguard) to my droplet. The only reason why i do this is so i can open the Ports on my VPS because my ISP doenst allow port forwading/opening and i dont have my own public IPv4.
Thats why i wanted to create a VPS and connect my self to it via wireguard.
I have no clue at all what im doing (hehe) and only using chatgpt to go around.
I managed to create the VPN and i can also connect to it and it shows the IP on “whatsmyip”.
But when i open the ports my NAT type is still on strict ingame and not open.
I also cant telnet the ports i opened on my droplet.
So i basically just want to know if this is even possible or if im wasting my time
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
You’re on the right track, but there are a few steps that might need tweaking to achieve what you want.
Ensure Correct IP Routing:
Make sure your VPS is correctly routing the traffic back to your local machine over the WireGuard interface.
You should have something like this in your WireGuard configuration on the VPS:
[Peer]
PublicKey = <Your_Local_Machine_Public_Key>
AllowedIPs = <Your_Local_Machine_WG_IP>/32
AllowedIPs
setting should be set to 0.0.0.0/0
if you want all traffic to go through the VPS.Port Forwarding:
iptables
or a similar firewall tool.sudo iptables -A FORWARD -i wg0 -o eth0 -p tcp --syn --dport <port> -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport <port> -j DNAT --to-destination <Your_Local_Machine_WG_IP>:<port>
sudo iptables -A POSTROUTING -t nat -o wg0 -p tcp --dport <port> -d <Your_Local_Machine_WG_IP> -j MASQUERADE
<port>
with the specific port you’re trying to open and <Your_Local_Machine_WG_IP>
with the WireGuard IP address of your local machine.Check Firewalls:
telnet <VPS_IP> <port>
from a different machine.Game and NAT Type:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.