New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Problem with OpenVPN
Hello,
I've using now my own VPN on a VPS, but i have a problem with the setup. Everything works fine, but after i'm connected to the VPN i cant access my server anymore with it's public. Only with the internal IP, like 10.8.0.1. I think it's some sort of NAT issue? Used google since three hours, but i can't find the solution. Can anyone help?
Comments
Have you forwarded traffic using iptables?
I used this script: https://github.com/Angristan/OpenVPN-install and activated UFW (forwarding changed to ACCEPT instead of DROP)
Following iptable rules are present:
i disable ufw also (didn't work either) but now the iptables are lot cleaner. So is anything missing?
OpenVPN resets your default gateway, so your VPS is not able to send back the traffic through it if it is coming to its public IP. You need to add a new routing table with your default gateway and use this table for all traffic originating from your VPS public IP i.e.
Thanks for your answer! I did this and replaced WAN GETAWAY with my wan getaway IP of my server and WAN IP with my public ip (server) and did ip route flush cache. But nothing changed. Did i anything wrong?
@ServerXZ would you mind to post all your routing tables and rules. You can mask a few numbers out of IP addresses with stars.
Sure. I hope that's all? If not, which commands must be executed? Im pretty new to iptables and routes
In /etc/default/ufw
DEFAULT_FORWARD_POLICY="ACCEPT"
in /etc/ufw/before.rules
START OPENVPN RULES
NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
COMMIT
END OPENVPN RULES