I hope someone can help me here, I'll be as concrete as possible.
Goal:
Use openwrt to create a vpn tunnel using openvpn and nordvpn.
Have 1 wifi network connect to internet through the vpn tunnel.
Have lan connect to internet using wan directly (no-vpn).
What I tried:
I followed the guide and although I hit a few bumps I finally got it working.
(Restart openvpn if you make changes in network and interface. Get the username list correctly into the conf file)
It will route all traffic through the vpn.
I then tried to put the lan zone back to the wan interface, so that my normal lan traffic would route out through wan. It worked too.
I then created a new wifi network, and put it in the same group as the vpn tunnel. But then I don't receive DHCP address on device.
If I add the lan interface to here, I get an address but then my traffic is routed out normally to wan.
Is there a way?
I only use the configuration website if possible.
Used the guide and set up NORDVPN again, worked fine.
In interfaces i have "ifVPN" with setup from the guide, unmanaged, and device "tun0". DHCP server->general and "ignore interface" is cheked.
Added below 2 lines to the OVPN config file
pull-filter ignore "redirect-gateway ipv6"
pull-filter ignore "redirect-gateway"
install pbr + luci-app-pbr from system->software
Added a new policy in PBR name VPN, remote adress "myip.com" interface "ifVPN" with "all" in protocol and "prerouting" in chain.
In frewall zones i added a new zone named "vpnzone" with input accept, output accept, forward accept
"lan -> wan + vpnzone" accept, accept, accept
"wan ->reject" with input reject, output accept, forward reject + maswerading
"vpnzone -> reject" with input reject, output accept, forward reject + maswerading + MSS clamping + covered networks choose the vpn interface
I did struggle a bit with getting it to work, sometimes it seems my DNS fails, sometimes if I disable a PBR policy, (and turn the service off) it's as if it's still there.
But finally I got it working, with the settings 99% as above (Might have forgotten some)
Trick for me (goal), all traffic is normally sent to wan, but specific remote destinations are routed through the VNP connection. All I have to do is add the remote locations, or a specific local IP.
It will be able to work for me, but requires a little more manual work.
The deluxe solution for me would have been having an entire wifi routed through the VPN, so if you connect to "VPN" wifi, you're always in the VPN network, but if you join normal wifi, youre just on wan.
egc, thank you for pointing me in a good direction!