OpenVPN on OpenWRT

Hello everyone.. I have installed OpenWRT on Rasperry PI 3B. I followed this guide https://openwrt.org/docs/guide-user/services/vpn/openvpn/client-luci to configure OpenVPN client, and added script up.sh and down.sh. Everything is working fine, except that the connected devices via Wireless do not get the IP Address from OpenVPN. If i run openvpn vpnserver.ovpn, the connection is working, the only problem is that these devices still get the IP from ISP. How can I fix this ? I've been trying for days to fix this, and still have not found any solution. Any help is appreciated.. Thanks

Could you explain a bit better what do you mean by

Which device is the DHCP server?
What default gateway does it provide to clients?

1 Like

Hello.. Thanks for your reply.

I have 4G Mobile router which is connected to second router (using only as a switch) and the raspberry pi is connected to the second router. When I connect my laptop via Wifi to the OpenWRT raspberry pi, the traffic goes through the ISP and not through the VPN.

The first router is the DHCP server and the default gateway is provided from the first router which is 192.168.9.1, the second is 192.168.9.2 and the Raspberry PI 192.168.9.3

If all your devices get dhcp settings from the ISP router, then they won't know that raspberry is the gateway.
You could try to change the default gateway option in the ISP router, but I doubt it has such an option.
You could drop dhcp and use static, but it gets harder on management.
Finally you could isolate the broadcast domains and use raspberry as an intermediate router, dhcp server for your lan, and gateway.

In Interface Lan DHCP is disabled and I use protocol static.. I think it has something to do with the interfaces and firewall zones...

I was referring to the hosts in the LAN, not OpenWrt.