How to fully export and import the VPN settings on OS X Lion?

I discovered the export option from OS X does not export things like: proxies, or DNS settings from the VPN configuration.

How can I export all of these?


Well I found a thread here that seems to accomplish what you're asking. I can't put it any better than forum poster himself, so here's what he said in case the page isn't working:

I figured out a way to do this, so thought I would post for anyone following me that has a bunch of VPN settings and doesn't want to manually key them back in. You will basically have to copy & paste a few GUIDs to make your old prefs data match your new system. This worked for me going from one Mac OS X 10.6 SL system to another SL system. I would imagine similar steps would work for Mac OS X 10.5 Leopard and possibly 10.7 Lion. Here we go:

  1. First, go to Network Preferences on your new machine and add VPN (L2TP), VPN (PPTP), or whatever VPN "interfaces" you need. Do not create any new VPN configurations at this time. Close Network Prefs.

  2. Open System Profiler, select and copy to the clipboard the Hardware UUID from the Hardware tab.

  3. Navigate to ~/Library/Preferences/ByHost and find your old NetworkConnections prefs file. It will have the form of com.apple.networkConnect..plist. Make a copy of this file. Replace the portion w/ the one you copied in step #2. Don't forget to remove any spaces and the " copy" tag. You should now have a new file called com.apple.networkConnect..plist.

  4. Open 2 files in an editor that can handle .plist files (I used TextWrangler): the com.apple.networkConnect..plist file you just made, and /Library/Preferences/SystemConfiguration/preferences.plist.

  5. In preferences.plist, look for the GUID of each VPN interface that you've created. The "UserDefinedName" string at the end of the key will tip you off:

<key>14A4B264-C231-41FE-857B-EE5557B69851</key> <dict> <key>DNS</key> <dict/> <key>IPv4</key> <dict> <key>ConfigMethod</key> <string>PPP</string> </dict> ... <key>UserDefinedName</key> <string>VPN (L2TP)</string> </dict>

The first long string ("14A4B264...") is the part you need. Copy this to the clipboard.

  1. Now move over to your com.apple.networkConnect file. Find the key that has all of your old VPN settings for that VPN type contained w/in it. Select all of the key name (which is the GUID of your VPN interface on your old Mac), then paste to replace it w/ the new GUID.

  2. Repeat steps 5 & 6 for each VPN interface you need. In my case, there were 2: L2TP and PPTP.

  3. Save your changes and close the com.apple.networkConnect file. Close the preferences.plist file WITHOUT saving anything.

  4. Open your Network Preferences, select your VPN interface(s), and you should see your past configurations.

Hope this helps you!