Is there a script to block outbound connection if vpn disconnects

Network

My vpn service drops from time to time and It reconnects again automatically but my real ip is exposed from the time is disconnects and reconnects which usually takes a couple of minutes.

Best Answer

Some VPN providers have 'Internet kill switches' for their VPN that will cut your Internet connection in case of a disconnect so check yours.

There is a large number of 3d party applications that will disable the outbound traffic if VPN disconnect.

VPN watcher...and others.

I suggest you use one of those, since making a script would be like reinventing the wheel.

But if you have to here are the instructions how to.

Creating a kill switch for the OSX VPN client