I hope you can help me. I have read so many how to’s and also looked into this forum. But I cant get it work.
What I want is to use my Dietpi as gateway for my LAN. On the Dietpi is NordVpn installed. Everything on the Dietpi works fine, the tunnel tun0 is connecting properly.
My LAN is 192.168.4.0/24
The gateway of tun0 is 10.8.1.1
What I have already done is:
net.ipv4.ip_forward = 1
redirect-gateway def1 in .ovpn (I dont know if this is necessary)
I tried with iptables and routings but it didnt work.
Jappe
Thanks a lot. These are the default routes when vpn is connected.
I dont know if they are correct or not. On dietpi everthing works fine.
I will check your suggestion.
Joulinar
Yes, the IP of dietpi is 192.168.4.33, so the default gateway is set on LAN clients.
It won’t work without masquerading, that’s for sure. So you’ll need to add the masquerade.
Another thing to try is to capture the packets: apt update; apt install tcpdump
Then run a packet capture on the eth0 interface to verify that the lan hosts use the Pi as a router: tcpdump -i eth0 -evn host 8.8.4.4
Run a ping to 8.8.4.4 and verify that you can see the packets.
If you can see them, run again the same capture on tunnel interface: tcpdump -i tun0 -evn host 8.8.4.4