Report this

What is the reason for this report?

Redirect port 3389 from eth0 to tun0 (OpenVPN)

Posted on March 19, 2020

Hello people. I tried in every way (that I know) to redirect a port (3389) of public ip origin through the eth0 interface to the tun0 interface virtual VPN network. But not work. Has anyone had this problem?

Hugs.



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.

To perform a port redirection, you will need to use iptables to forward traffic from the public IP on the eth0 interface to the private IP on the tun0 interface. Here’s an example command to achieve this:

  1. iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination [PRIVATE_IP]:3389

Replace [PRIVATE_IP] with the private IP address associated with the tun0 interface. To make this redirection persistent, you’ll have to save your iptables rules and restore them on boot.

For more information on iptables and configuring your firewall, check out our documentation here: How To Implement a Basic Firewall Template with Iptables on Ubuntu 20.04.

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.