Page 1 of 1
Block Connection when VPN Disabled
Posted: Mon May 13, 2013 2:57 pm
Is there a way with Viscosity to block any network connection when the VPN is disabled?
Re: Block Connection when VPN Disabled
Posted: Mon May 13, 2013 4:03 pm
While there isn't a way built into Viscosity, you can achieve this using Viscosity's scripting support. The easiest way to achieve this is to bring your main adapter down when you disconnect, and back up before you connect.
To do so, you will need to create two batch scripts. Open a text editor (like notepad) and enter the following, replacing Ethernet with the name of your primary network adapter you use to connect to the internet:
netsh interface set interface name="Ethernet" admin=DISABLED
Then save the file as 'disconnected.bat' or similar. Then you will need to make a second batch script, saving it as beforeconnect.bat for example, with the following contents:
netsh interface set interface name="Ethernet" admin=ENABLED
Then, edit your connection, go to the advanced tab and set the beforeconnect.bat script as the Before Connect script, and the disconnected.bat script as the Disconnect script and save your connection.
The only downside to this is unfortunately these commands require Administrator privileges to work, so you will need to run Viscosity with Administrator rights for these scripts to function properly.