I'd like to run a pptp vpn server on a raspberry pi in my home network behind a fritz.box.

It should work like this:

Android - internet - fritz - raspberry-pptp - internet

Client can connect, but no internet access.

1723 and GRE are open on fritz and should go to raspberry.

How do I have to iptable to make Android get internet via raspberry?

2 Answers 2


If you are using the standard pptpd you need to ensure your client gets an ip address from the server and traffic forwarding is enabled on the raspi as well as iptables are configured correctly.

In /etc/sysctl.conf uncomment or add net.ipv4.ip_forward=1 to enable the forwarding of IPv4 traffic. Now you can configure iptables forwarding with sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Please note that the iptable rule will be deleted on restart of the pi so you might want to add a cron job to run it for you when the raspi reboots.

More info on this can be found here: https://www.domoticz.com/wiki/Installing_a_PPTP-VPN_server_on_a_Raspberry_Pi


Previously I had used iptables to redirect 80/443 to Tomcat. I had taken one of the many examples on the net (like this one) and fell into the trap that it forwards all traffic to Tomcat, so the VPN traffic, too.

The 80/443 rules must be restricted with --dst to the public IP:

iptables -t nat -I PREROUTING --src 0/0 --dst -p tcp --dport 80 -j REDIRECT --to-ports 8080

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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