Store
 

Can I make two VPN connections mutually exclusive? - KH2560

Frequently Asked Questions

Can I make two VPN connections mutually exclusive?
 

Do you switch between development and production environments and want connecting to DEV to disconnect the production VPN automatically—and vice versa?

VPN Tracker does not offer a configurable mutual-exclusion rule. On a Mac, you can automate the switch with two AppleScript actions: after each VPN connects, its action disconnects the other VPN.

1. Disconnect Prod when DEV connects

Our example connections are named Development VPN and Production VPN. Open Script Editor on your Mac and enter:

tell application "VPN Tracker 365"
    stop connection "Production VPN"
end tell

Save it as Disconnect Production VPN.scpt using the Script file format. The name in quotes must exactly match your production connection.

  1. Select Development VPN and open Configure > Actions.
  2. Under Actions After Connecting, enable Execute AppleScript.
  3. Choose the saved script, then click Save.
Development VPN: enable Execute AppleScript and select Disconnect Production VPN.scpt

2. Set up the reverse action for Prod

Create a second script to disconnect the development VPN:

tell application "VPN Tracker 365"
    stop connection "Development VPN"
end tell

Save it as Disconnect Development VPN.scpt and add it to Production VPN using the same action settings. Save this connection too.

Production VPN: select Disconnect Development VPN.scpt

Connecting to DEV now disconnects Prod automatically; connecting to Prod disconnects DEV. Use unique connection names and keep both script files in a permanent folder.

Test both directions when it is safe to interrupt the connections. Avoid starting both VPNs simultaneously: both scripts could run and disconnect both VPNs.

More about AppleScript automation in VPN Tracker.