I have a raspberry pi and multiple hosts that I would like to connect to a VPN in a physical manner, i.e. I would like to be able to plug my devices into one (unmanaged) switch and have them connected through a VPN, and plug devices that I want to access the internet directly into another. I still want the DHCP server on my router to manage IP addresses for every host.

I have tried a few things so far, and have a working openvpn client connection to my VPN provider, which provides tun0. I have a USB network adapter, which is shown as eth1, and would like to send packets from eth1 (connected to switch), to eth0 (connected to router) if it is local & vice versa, and send all packets bound for the internet read on eth1 to tun0.

PI as VPN gateway which routes all requests through a VPN tunnel was helpful but didn't work for me in the end.

https://raspberrytips.com/raspberry-pi-vpn-gateway/ was what i started with, as I believed a wireless access point surely was not dissimilar to what I am trying to achieve, however, the creation of an access point was handled with nmcli at a pretty high level, and I am unable to translate that into using a network interface instead.

My internet connection is not very high bandwidth, doubly so with a VPN, so I am not worried about this process being inefficient.


Your Answer

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

Browse other questions tagged or ask your own question.