OpenVZ Forum


Home » General » Support » Unable to run OpenVPN - "openvpn --mktun --dev tap0" fails
Re: Unable to run OpenVPN - "openvpn --mktun --dev tap0" fails [message #23991 is a reply to message #22341] Thu, 29 November 2007 18:33 Go to previous messageGo to previous message
OpenVZ is currently offline  OpenVZ
Messages: 3
Registered: November 2007
Junior Member
tomfra wrote on Thu, 25 October 2007 17:31


/sbin/iptables -A FORWARD -j ACCEPT -p all -s 0/0 -i tun0
/sbin/iptables -A FORWARD -j ACCEPT -p all -s 0/0 -o tun0
/sbin/iptables -t nat --flush
/sbin/iptables -t nat -A POSTROUTING -s ! x.x.x.x -o venet0 -j SNAT --to-source x.x.x.x

Replace x.x.x.x with your VPS public IP address. You should probably include those lines in the openvpn init file in /etc/init.d . Technically, only the last line may be necessary. There are probably better ways but this should work. I use CSF firewall and I added those lines to csfpre.sh instead.




Hello tomfra,

thank you for this HOWTO.

It works.. But only if I set a public IP to the VPS.

If I set an internal IP to VPS like 192.168.1.5, (for testing) I can use it as a webserver ( =>can reach from outside), but openvpn doesn't work..

What should I do to get it working?

Thank you..


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: *SOLVED* No Internet access on VEs (but I get remote SSH access)
Next Topic: Warning: Variable TEMPLATE not found in /etc/sysconfig/vz
Goto Forum:
  


Current Time: Tue Sep 17 04:34:22 GMT 2024

Total time taken to generate the page: 0.04855 seconds