I use the built-in VPN on Mac OS X 10.7.3. It's IPSec, FWIW. From time to time, it disconnects (probably an issue with my corporate server). Is there a way to get it to automatically reconnect? Sometimes I don't notice for a while, which is kinda annoying.
You could use the following AppleScript, save it as an application and set it to be a agent (no dock icon).
This script will setup a VPN connection when there is none. Therefore, it should also reconnect shortly after your connection drops. You can change the interval to check your VPN connection, it's 120 seconds in the script.
I've explained how to set this up in this answer.
I made some changes to the provided answer, because if something is worth doing it's worth doing into the ground. I wanted to reconnect if the VPN was dropped, but NOT reconnect if the VPN was intentionally disconnected. The solution I came up with was both effective and inelegant.
First I added hooks to the pppd startup and shutdown to keep track of the desired VPN state. These files should be owned by root, and have world read/execute permissions (
Then by modifying the AppleScript above, I was able to check the '/var/run/reconnect_vpn' status variable to determine whether to bring the VPN back up:
As before, change the line
I have a feeling that if you're the kind of person is this particular about VPN behavior, then you're also the kind of person who likes fumbling around until you find a solution and therefore this answer has no audience. But just in case, here it is. Hope it helps somebody.
There's an app that does it called VPN Auto-Connect (Mac App Store link). It's $0.99.
Once started, it lives in your menu bar; when you use it to turn VPN "on", it will monitor a VPN connection profile you set up in OS X's Network preference pane and ensure you always remain connected to it. VPN Auto-Connect's menu-bar icon provides a list of all the VPN connections you've defined and lets you choose which one to always connect to.
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
I'm using different approach to keep my VPN connection alive.
This involves getting a very simple
and enter following content :
You can use following command to start your daemon and test :
This way, you have a daemon running for all users, connection attempted only when internet connection is available. Also, VPN is reconnected automatically when internet connection is back…