For almost a year I have struggled with VPN on my macbook pro. The problem is that when my laptop goes to sleep while VPN is on (like when I shut the lid) I can no longer connect to VPN again when I open the lid. The error is the less than helpful, “Configuration error. Check settings and try to reconnect.” See the thread on discussions.apple.com for more angst on that topic.
The normal work-a-round are these two commands which restart the racoon subsystem.
> launchctl stop com.apple.racoon
> launchctl start com.apple.racoon
I have now found a better way.
There is a program called sleepwatcher written by Bernhard Baehr. While it’s install is very manual, it works very well. I now have a file in my home dir called .sleep and it runs a few commands when my laptop goes to sleep. One of them shuts off VPN and the other unmounts and external disks.
The script to disconnect VPN is a variation on the one published at Drinking the Apple Juice. The unmount command was from Mac OS X Hints.
It would all be simpler if I had init levels, but at least I have a solution.