AppleScript: McVPN

This bandaid is mighty handy for pesky OSX disconnects. I don’t really know what causes it and unfortunately, I don’t have time to fully figure it out. I do know that changing my gateway back to my local gateway helped tremendously. Also, changing my default nameserver to a local nameserver helped too. Now, I get disconnected but its after hours or days instead of minutes.

My system.log referred to lookupd issues and my ping had some sort of buffer problem. That’s for you Googlers looking for a solution. Well, here’s one…sorta. Throw this in a cron job run by root.

This script requires that you have a webserver on the VPN..that’s how it checks for a connection. Internet Connect will sometimes report that it’s connected when it’s not working so this is a better way to tell. It then issues a few commands to change the gateway back to the local one and then rewrites the resolv.conf so that DNS lookups are performed on a local dns server instead of over the VPN.

If I ever have the time figure out how to fix this intead of applying a band-aid, I’ll be sure to update this page.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in Networking, Security

Leave a Reply

Your email address will not be published. Required fields are marked *