Hello! I am on a Debian 7 OpenVZ vps. At first I could not connect to the internet through the openvpn on the box, but after searching the forums I found that I needed to enter this command:
:~# iptables -t nat -A POSTROUTING -o venet0 -j SNAT --to-source 162.xxx.xxx.xxx
(162.xxx.xxx.xxx being the IP on my VPS.)
Everything seems to work well until I reboot the server, and then (usually, but not always) I have to log back in and re-enter the command to be able to reach the internet again.
server.conf
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
client.conf
client
dev tun
proto udp
remote xxx.xxx.xxx.xxx 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert xxxxxxxxx.crt
key xxxxxxxxx.key
ns-cert-type server
comp-lzo
verb 3
remote-cert-tls server