I knew it’s possible to setup VPN connections using native System Preferences in macOS, but discovered recently that it’s possible to manage them from command line.
Today I’ll just show you how to connect or disconnect from an existing VPN profile – perhaps some other time I’ll explain how to setup VPN profile and connection parameters from scratch.
Reviewing Network Connections in System Preferences
You can find existing connections – networked, wireless, bluetooth and VPN – in Network section of the System Preferences app:
FIXME
You can simply click the Connect button to activate VPN connection if you’re already there in the settings screen. But using command line it’s possible to activate the same VPN connection without ever opening System Preferences app or selecting the profile using keyboard and mouse.
Activate VPN Connection using networksetup
networksetup command lets you manage lots of network connection aspects.
Here’s a command to activate VPN connection for my profile HomeVPN:
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!