Question

OpenVPN Access Server droplet open port to client though vpn

Posted July 7, 2021 70 views
UbuntuVPN

I have created an OpenVPN server with the one-click droplet installation from the marketplace (without pihole).

My Windows client (172.27.232.2) is connected to the OpenVPN server (188.x.x.x). On the Windows client, I have opened port 8080, and I can telnet to 172.27.232.2 on port 8080.

Now I have to setup my OpenVPN server, to forward port 8080 to my Windows client, so that if people connect to 188.x.x.x:8080 they will connect to my Windows client.

I have no experience with Ubuntu/Linux distibution, so I tried to follow some steps from this tutorial: https://www.digitalocean.com/community/questions/how-to-setup-port-forwarding-after-enabling-openvpn-droplet

Basically what I did on the OpenVPN server is this:

iptables –table filter –list INPUT –line-numbers

iptables –table filter –insert INPUT 6 –protocol tcp –dport 8080 –jump ACCEPT

iptables –table filter –list FORWARD –line-numbers

iptables –table filter –insert FORWARD 3 –protocol tcp –destination 172.27.232.2 –jump ACCEPT

iptables –table nat –append PREROUTING –protocol tcp –dport 8080 –jump DNAT –to-destination 172.27.232.2:8080

iptables –table nat –list POSTROUTING –line-numbers

RESULT:

1 SNAT tcp – anywhere 10.0.0.33 tcp dpt:8080 to:188.x.x.x
2 AS0NATPOSTRELEST all – anywhere anywhere state RELATED,ESTABLISHED
3 AS0NATPRE all – anywhere anywhere mark match 0x2000000/0x2000000

To be honest, I have no idea what I just did, but the port is not open when I try to connect to 188.x.x.x:8080 and the result from iptables –table nat –list POSTROUTING –line-numbers seems like the 10.0.0.33 is wrong to me, but I have no idea what I did wrong or how to fix it.

Can someone please point me in the right direction. I have tried to find some other tutorials but it seems like I use the wrong terms to find it.

Thanks.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!