Mac OS X: Turn off WiFi/Ethernet if connection to OVPN is lost

By default, our client configuration for Tunnelblick contains a script that automatically shuts down uTorrent and BitTorrent if you are ever disconnected from OVPN.

The script also contains the possibility to turn off WiFi and Ethernet. To activate this functionality, do the following steps:

  • Download a configuration file for Mac OS X.
  • Extract the content from the .zip file.
  • Right-click on the .tblk file that was extracted in Step 2.
  • Choose ’Show package content’.
  • Open with a text editor.
  • Find the lines containing:

killall ”uTorrent” killall ”BitTorrent”

  • Place a # before all of them so that it looks like this:

♯killall ”uTorrent”

♯killall ”BitTorrent”

  • Find rows:

♯ ifconfig en1 down

♯ ifconfig en0 down

  • Remove the # sign in front of the line to get this following result:

ifconfig en1 down

ifconfig en0 down

  • Done

  • If your OVPN connection is lost at any point, you will need to manually activate the WiFi and Ethernet to make it work again. You do this by entering the following in the terminal.

sudo ifconfig en1 up

sudo ifconfig en0 up