Hello everybody,
I have configured the openvpn client on my router following this guide: OpenVPN client using LuCI
I have also enabled the killswitch functionality, but I have noticed that when I close the vpn connection the router itself can still connect to Internet.
Is there a way to block also router connection to Internet when vpn is down, or is this a meaningless question (I am relatively new to networking with OpenWrt)?
How exactly did you implement this? Normally it should only affect the lan.
Let's see your config files:
Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
OpenVPN being a process on the router has to use the wan interface (regular Internet) to send its encapsulated and encrypted packets to the VPN server. When OpenVPN closes down, it removes the default routes via the VPN tunnel and allows default routing from local processes by regular Internet.
If you want to prevent the router from ever using regular Internet for anything but encrypted packets to the VPN server, configure that in the firewall-- block all output on wan except for the one IP of the VPN server.
It will probably also be necessary to allow unencrypted NTP, as the clock must be set for SSL to work.
Yes, my primary upstream router has address 192.168.1.1 and the router with OpenWrt I am using has address 192.168.1.200 and it it connected to the first one using one of its lan ports.
When I bring down the OpenVPN tunnel I was expecting that, because of the kill switch, the OpenWRT router could not connect anymore to Internet, instead I see that even if the OpenVPN tunnel is down I can ping external addresses from the OpenWrt router.
The router always needs to be able to reach the upstream/internet if you want to be able to do things like connect to a VPN... otherwise, you have a chicken-or-egg situation.
The OpenWrt router is not the primary gateway... it has a gatway defined (192.168.1.1) so connections destined for any address other than 192.168.1.0/24 will go be sent there by default.
If you remove the gateway, you also remove the router's ability to connect to the internet in general, which means it cannot establish a VPN connection.
Yes, it makes sense. Let then narrow the requirement: suppose I just want that an application (say irssi) which is running in the OpenWrt router loses its connectivity if the vpn is not working.
Is this feasible?
Connect your upstream to a separate wan network. In other words configure this as if it were a main router. Then you can put strict controls on what goes out of wan without breaking services on lan.