Showing posts with label 25.10. Show all posts
Showing posts with label 25.10. Show all posts

Monday, August 18, 2025

Implementing a killswitch when your VPN connection drops on Ubuntu

VPN setup on ubuntu

I setup the VPN in these 2 modes in Ubuntu 24.04, 25.04, 25.10, screen shoots are from 25.10. 

Using only ubuntu pre packaged dpkgs, and using the proton provided app. Both work fine, the Proton app has more features if you are paying for it use it. 

Option 1 - Pure Ubuntu

Goto https://github.com/lafa/vpn_enforce and follow the instructions.

This assumes you already configured your vpn on gnome network settings.

This script enforces that your VPN needs to be running for the the web traffic to work, even after you disconnect from WIFI or restart the laptop.

to turn it off use

sudo ufw disable  

 References:

https://github.com/lafa/vpn_enforce 

 

Option 2 - Proton vpn 

If you are using the Proton VPN app:

Use  this https://protonvpn.com/support/official-linux-vpn-ubuntu/ to install the packages on ubuntu.

Turn auto start on gnome settings

 

 On the Proton VPN settings enable Kill switch, to make sure you all your traffic goes thru the vpn, you can enable net shield in case you trust Proton to filter your web traffic. you can also enable port forwarding to allow your computer to interact with devices on your local wifi, like google cast, spotify , etc. I also always disable IPV6, since i don't think this need for local home networks, so why bother with extra complexity.

 

On the settings also set the "Pinned tray connections" to what countries or servers you want to connect to on the tray menu.

 

For example, for mine, I use US for USA, PT for Europe and US -CA servers for when I am in CA for reduced latency, and CH/IS/SE servers for real secure connections when you want extra security from wifi networks you don't trust.  

US, PT, US-CA#1, US-CA#2, US-CA#3, US-CA#4, US-CA#80, US-CA#820, US-CA#908, CH-PT#2, IS-PT#1, SE-PT#1, CH-US#3, IS-US#1, SE-US#1, SE-US#2

  

 

 

Implementing a killswitch when your VPN connection drops on Ubuntu

VPN setup on ubuntu I setup the VPN in these 2 modes in Ubuntu 24.04, 25.04, 25.10, screen shoots are from 25.10.  Using only ubuntu pre pac...