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
Hey, this was a god sent reply. However, it doesn’t work for me now after reboot. It does work when I am installing tailscale for the first time and then adding these routes on the tailscale subnet router. But after reboot, it stops working. I am persisting the routes using iptables-persist.
Any idea what could be the issue or how I could debug this?