I recently bought a VPS and want to setup openvpn in it. After reading HOW To on openvpn, and trying to do my best to understand iptable, I still can't seem to get it right! :cry:
I can connect client1 to my vpn server but I cannot connect to the internet (unless I disable "redirect-gateway def1")
Server
local 69.172.205.41
port 1194
proto udp
dev tun
key /etc/openvpn/keys/server.key
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
dh /etc/openvpn/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
#client-config-dir ccd
#route 192.168.0.102 255.255.255.0
#route 10.9.0.0 255.255.255.0
push "route 192.0.2.0 255.255.255.255"
#push "redirect-gateway def1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 8.8.8.8"
keepalive 10 120
cipher AES-128-CBC
#comp-lzo
max-clients 1
user nobody
#group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
Client1
client
dev tun
proto udp
remote 69.172.205.41 1194
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert client1.crt
key client1.key
cipher AES-128-CBC
#comp-lzo
verb 3
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.0.2.1 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 192.0.2.1 0.0.0.0 UG 0 0 0 venet0
iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/24 anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Could someone enlighten me what I did wrong?