PDA

View Full Version : OpenVPN and Firewall


Spok
17th June 2008, 09:29 PM
Hi,

Plesk 8.4 is running fine with nearly as default settings as it was installed.
Additionally I installed OpenVPN and that machine, following the installation guide of OpenVPN (it's not the VPN Module,hwat i am talking about, just a fresh installation of OpenVPN), which is also doing fine. The Client can connect, the connection is established.
Therefore I needed to change the Firewalll settings so that Port 1194 is open to receive OpenVPN Packages. I made this setting in the firewall module.

So far so good, now, i would like to allow the OpenVPN client to access the internet through eth0. So i followed the instruction to make iptables settings as described in the OpenVPN FaQs. Unfortunately this doesn't work.
What I guess is, that the rerouting from tun0 to eth0 or the nat on eth0 is not working propperly...
Could somebody give me a hint or some suggestions how to solve this issue please?!

thanks

atomicturtle
18th June 2008, 08:02 AM
What rules did you use to do it? Did you enable ip_forward? Example: echo 1 > /proc/sys/net/ipv4/ip_forward

Spok
18th June 2008, 08:03 PM
Hi,

I was using

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -i tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -j ACCEPT
iptables -A INPUT -i tap+ -j ACCEPT
iptables -A FORWARD -i tap+ -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE


after that I tried, but not working, meaning not able to ping or connect to an internet IP with the client.
After that I tried adding a rule into Plesks Firewall Module, at the forwarding section, saying to allow forwarding connections from OpenVPN IP Range basically 10.10.1.0/24 to anywhere on every port.

Still the client was unable to do a ping to an outside IP.

Any idea?

thanks

dedidude
7th September 2008, 04:32 AM
I recently set up OpenVPN, I just checked the notes I took while I got it to work and I did most of the things you did, too, plus one more:

iptables -A INPUT -p udp --dport 1194 -j ACCEPT


Also if you are using APF on your server, you need to do a couple of other things to make it work.