Automatically Reconnect Your Mac To VPN


Mac: A Virtual Private Network (VPN) is a great way to browse the web securely, and Mac OS X has a VPN option built in. The problem is that it doesn’t always automatically connect when you boot up your computer or after it disconnects. A simple Applescript over on Stack Exchange solves this problem.

To enable this function, open up Applescript (Applications > Utilities) and paste in this code (replace “VPN University” with the service name you use):

on idle
    tell application "System Events"
        tell current location of network preferences
            set myConnection to the service "VPN University"
            if myConnection is not null then
                if current configuration of myConnection is not connected then
                    connect myConnection
                end if
            end if
        end tell
        return 120
    end tell
end idle

Then save the script as an application with the “Stay Open” box checked. Now, when you’re browsing with a VPN, say, at a cafe or just at your own house, OS X will automatically reconnect if the connection drops. The Applescript should work in both Mountain Lion and Lion. Head over to StackExchange for the full step-by-step instructions.

Auto connect VPN upon login/boot [StackExchange via One Thing Well]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


Leave a Reply