I would like to route all traffic created by my machines through a VPN tunnel. The PI should simply dial in and establish a connection to the VPN server and then route requests from the other machines to the VPN server.

My network looks like this:

Internet -> Router with Firewall (
                                    |-> iPad (DHCP)
                                    |-> PC (DHCP)
                                    |-> Raspberry Pi (
                                    |-> AppleTV (DHCP)

The PI is connected to the router by LAN.

Summary of the setup:

    1) PI connecting to the internet directly through the default router
    2) PI creates a VPN connection (OpenVPN) and listens on its local interface for traffic

I have set 3 firewall rules in the router
    3) the communication between PI and VPN is allowed
    2) the communication between PI and other machines is allowed
    1) commuications aren't allowed

I have installed OpenVPN on the PI and the PI is able to establish a connection to the VPN server. Firewall rule 3) is working. I can ping the Raspberry PI with my PC, so also firewall rule 2) is working. Im not able to access the Internet with my PC, so also firewall rule 3) is working.

To get access to the Internet with different devices, the PI must listen on its local interface for traffic. It should route requests from other machines through the VPN tunnel.

I have already tried the instructions of this post, but I had no luck with it: PI as a VPN router for local machines

The traffic create by my machines didn't get routed by the PI through the VPN. It seems like that the PI of the author of this post, is connected with its eth0 to the router and its eth1 or wlan0 to other machines. So it's the middleman beetween router and the other machines. In my case the PI isn't a middleman. It's just connected to the router with eth0.

It would be really nice if you can help me. Thank you.

  • This isn't an exact duplicate; the other question involves a PPTP link; this involves OpenVPN which does not use PPTP but tunnels layer 2 or 3 traffic through TLS. While the networking configuration at the level above the network interface will be almost identical (as it would be for any basic Internet connection), the configuration of the connectivity from that network interface onward will be rather different.
    – cjs
    Apr 7, 2017 at 23:28


Browse other questions tagged or ask your own question.