Secure traffic before connecting to wifi/VPN

NetworkSecurityvpnwifi

Usually when you wake up your MacBook, macOS automatically establishes e.g. IMAP or various background sync connections. How can I make sure that all traffic is sent over to VPN connection BEFORE I connect to wifi or my VPN connection fails?

I am using Apple’s built-in VPN client in OS X 10.12. VPN service order is set prior wifi in the OS X Network location. Also, the checkbox for for „Send all traffic over VPN connection“ is enabled.

Best Answer

According to an article by How-To Geek How to Connect Your Mac to Any VPN (and Automatically Reconnect), there is an app that can do this for you, but first:

The “Advanced” button allows you to configure the VPN connection in other ways. For example, the default settings automatically disconnect from the VPN when you log out or switch users. You could uncheck these boxes to prevent the Mac from automatically disconnecting. Click Apply to save your settings. Before you do, you can enable the “Show VPN status in menu bar” option to get a menu bar icon for managing your VPN connection. Use this menu to connect to your VPN and disconnect from it as necessary.

However, the article also says:

By default, your Mac won’t automatically reconnect to the VPN if the connection dies.

VPN AutoConnect by Nova-box is the app the article talks about, but it does not have a very good rating, so I am not sure if it would benefit you.

I use a VPN, but I am not using Apple's client for this. I use the VPN's client. I did download it from the App Store, and it has been great thus far—there is a feature that allows you to prevent any traffic from running until the VPN is up and running.

The VPN I have is VPN Unlimited - WiFi Proxy. I purchased a lifetime subscription for around $20 from Cult Of Mac when they had a special on it.

There could be Terminal commands for this as well. I have found this other Ask Different question for you to take a look at: Where is the "Send all traffic over VPN connection" setting in OSX 10.9 Mavericks?

This last link to a Tuts+ article How to Use VPN on Your Mac is basically what you said you already did, from my understanding, but I thought it might be useful in case you wanted to double check your steps (since I haven't used the Apple client, I can't speak for it, hence this link).

Good luck!