Report this

What is the reason for this report?

VPS as transparent gateway

Posted on August 21, 2021

Hya,

after some years, my ips implemented cgnat, making impossible to forward ports.

I have my own registerd domain name and noip updated by change of dynamic ip address.

So, i got a droplet, configured wireguard and also installed apache. The droplet is the wireguard server and my home server the wireguard client. Works, at least from my server i can ssh to my wireguard server, with the vpn addresses.

By noapi, i will point my domain to the droplet ip.

How to have the VPS port forwarding directly to my home server, my internal SSL server, acting as a transparent bridge for a range of ports?



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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

Unfortunately, DigitalOcean doesn’t support port forwarding at the networking level.

You can, however, achieve this by configuring your VPS to forward the traffic. You can utilize tools such as iptables or ufw to route incoming connections to your VPS to the proper internal address that’s connected to your VPN.

Please note, if you’re using Apache as a reverse proxy, you can also use this to route your http traffic.

Please remember to open firewall rules for the inbound traffic on your desired ports on both the VPS and your home server.

Here’s a guide on how you can use iptables to forward traffic: How to Forward Ports through a Linux Gateway with Iptables. This should give you an idea on how you can set this up.

If you have any further queries, feel free to ask! I’m here to help.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.