MacOS – Mavericks – VPN command line

macosNetworkterminalvpn

I see a lot of third party apps that offer the ability to turn your Mac into a VPN server. It seems the VPN server functionality is built into OS X from what I've read but you need OS X server to get the GUI or a third party tool.

So if it's built in, can I configure VPN (DNS, IP, users, etc) from a command line instead of using some GUI? If so, how would I go about configuring everything?

I want to enable VPN on my Mac Mini (Mavericks) so I can use my iPhone to VPN into my home network. I have an Airport Express and have the proper ports forwarded to my Mac already.

Best Answer

On Mac OS X the VPN connections are handled by a daemon vpnd, which should be started at boot by altering /etc/hostconfig so that the line VPNSERVER is set to "-YES-".

Don't do that until you have read and understood the man page for the vpnd configuration plist file and written the file. You can get a good explanation of the file and a template with man vpnd -s 5 at the command line. While testing you can run vpnd from the command line with the "-d" option which stops it going to the background and prints the log info to your terminal session - just the thing for watching it all go wrong.

Have fun! Frankly I pay the $20 or so for the Server app and get the GUI for stuff that fraught with peril - you don't want to get the security on a VPN wrong.

BTW - If you're going to be playing at the command line then here's a tip - you could have learnt most of that by starting with apropos vpn at the prompt.