Openvpn – forward eth0 traffic over tun0

dhcp-servereth0openvpnvpn

I'm trying to setup a raspberry pi 3 as a vpn access point(?)

So far I have wlan0 configured to connect to a mobile hotspot, when this is connected openvpn connects to the vpn server.
This works fine, SSH'd in to the raspberry pi I can see anything I do on there goes over the tun0 interface.

I have now setup a dhcp server on eth0. This is working fine and hands out an IP address to the laptop when its hardwired. However I can't get any network access at all and ultimately want to send you all eth0 traffic over the tun0 interface.

I have enabled net.ipv4.ip_forward=1 and also added the following iptables rules

sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o tun0 -j ACCEPT
sudo iptables -A FORWARD -i tun0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

What am I missing here?

Best Answer

Okay,the setup does actually work. The iptables rules had not been saved after a reboot (Doh!)

Related Topic