0

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
  • What are your iptable and dns settings? In my experience if you can connect but not get out that's usually the problem. – Mobalized Jan 11 '17 at 17:43
  • I added my iptable settings. How/where can I confirm my dns settings? – brewcrazy Jan 11 '17 at 18:09
  • @Mobalized - Does the info I provided contain any clues? Thanks – brewcrazy Jan 12 '17 at 17:42
  • Your dns server is set in the server.conf file. I personally recommend using the google dns. As for the ip tables and other settings I'd reference the link I am posting. There are two iptable options listed in this tutorial, try both. Also I would try running the iptable from the terminal if it doesn't work when you run it from a file. Hope this makes sense. – Mobalized Jan 12 '17 at 20:09
0

Thanks to recommendations by @Mobalized, I was able to resolve this.

I had not paid enough attention to this line in server.conf:

# If your router does not do DNS, you can use Google DNS 8.8.8.8

The non-working configuration that I had pointed to my router. Note the line mentioning that this should be your router's address. This was pulled from the many online openvpn guides that I had been referencing in my setup:

    # If your router does not do DNS, you can use Google DNS 8.8.8.8
    push "dhcp-option DNS 192.168.10.1" # This should match your router's IP address.

What I now realize is that my router isn't doing DNS (yet), so following the note's guidance, and using my router's IP, was what caused my issue. I changed it to use Google's DNS and everything is working.

# If your router does not do DNS, you can use Google DNS 8.8.8.8
push "dhcp-option DNS 8.8.8.8"

All of the details of my other configuration files can be found at the following link and may be useful for someone troubleshooting the same issue: https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=170932&sid=41162d847f0bcbafebdecd61c5644c3f

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.