I've been following the various RPi openvpn guides on the internet over the past few weeks to set up an openvpn server. I have it mostly working, but when I'm connected to the vpn on the client, I have no internet. I've spent many hours troubleshooting this, but to no avail.
Note: if I follow the direction of the second answer here: https://stackoverflow.com/questions/21371530/no-internet-on-openvpn-connection and change the Set DNS/WINS option in tunnelblick on my mac to "Do not set nameserver", then I DO get internet when connected to the VPN and everything works. However, this seems like a hack. I do not have that option when connected on my iPhone using the openvpn app.
I'm hoping that the above is a clue to someone more knowledgable about what's going on. I'm happy to provide any of my configuration files if that's helpful as well.
firewall-openvpn-rules.sh:
#!/bin/sh
#iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j SNAT --to-source 192.168.10.115
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
/etc/network/interfaces:
...
iface eth0 inet static
pre-up /etc/firewall-openvpn-rules.sh
address 192.168.10.115
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
iptables -t nat -L
outputs:
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/24 anywhere
MASQUERADE all -- 10.8.0.0/24 anywhere