1

I set up a VPN server on my Pi3 following the same steps that I did in Ubuntu (link). I use that VPN server daily without issue.

I can successfully connect to the VPN, but I cannot get to the internet. I have tried or checked:

  • disabling ufw
  • /etc/default/ufw to include DEFAULT_FORWARD_POLICY="ACCEPT"
  • cat /proc/sys/net/ipv4/ip_forward --> 1
  • sudo nano /etc/openvpn/server.conf contains without comments:
    • push "redirect-gateway def1 bypass-dhcp"
    • push "dhcp-option DNS 208.67.222.222"
    • push "dhcp-option DNS 208.67.220.220"
  • I then read some posts about changing iptables which I did not have to do in ubuntu, but gave it a shot anyway (not really knowing what I am doing here)
    • sudo /sbin/iptables -P FORWARD ACCEPT and
    • sudo /sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
  • Another iptables edit:
    • sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j SNAT --to-source 192.168.107.3
  • ssh into the pi and can ping google.com
0

I didn't follow the same guide as you but have a similar setup. Try the following:

Clear out your old rules with these commands

sudo iptables -X
sudo iptables -F
sudo iptables -t nat -X
sudo iptables -t nat -F

Add this single iptables rule

sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

Alternatively http://www.pivpn.io takes all the heavy lifting out of the equation with their rather helpful script.

  • Thanks but did not work. Had to do -F first (which booted me from my ssh) bc -X had iptables: Too many links. but then went back and did -X. Any other ideas? I would like to get it working without pivpn if possible... – atclaus Aug 5 '17 at 20:21
  • When I check sudo iptables -L and -S I do not see the rule you have me add. Should I? Where else can I look? – atclaus Aug 5 '17 at 20:35
  • Got it to work by changing eth0 to wlan0 as I am connected over wireless. Should have caught that. Followed the instructions at this link to add a boot script that does the iptables automatically. readwrite.com/2014/04/10/… – atclaus Aug 5 '17 at 21:17

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.