What I wanna do is to have the internet connection disabled completely when the VPN connection goes down. I am connecting to my VPN (privatevpn.com) through Viscosity.
I have tried everything in the book. I have tried to have a disconnect scripts in Viscosity, but they never trigger, or trigger inconsistently and leave my connection vulnerable. I also tried routing tricks in Viscosity but it doesnt work either.
On my Ubuntu machines I have a solution that works perfectly, I use ufw rules to control the firewall. In order to connect to my VPN I need to disable UFW, and then once the VPN have connected I enable UFW, and it keeps the connection tight from leaking.
There is something called pf on Mac. I might be able to configure pf to work the same way as my ufw rules work, but I don´t understand how to configure it.
Here are my UFW rules I would like to run on the Mac as well, maybe someone can help me to configure pf to use the same rules?
Status: active Logging: on (low) Default: deny (incoming, deny (outgoing), disabled (routed) New profiles: skip
To Action From Anywhere ALLOW IN 126.96.36.199/24 Anywhere ALLOW OUT 188.8.131.52/24