How to create a VPN connection via terminal?
You can use these wonderful bash functions from @slhck at Super User:

To connect to different VPNs, have multiple VPNs in Network.prefpane.


function vpn-connect {
/usr/bin/env osascript &lt;&lt;-EOF
tell application "System Events"
        tell current location of network preferences
                set VPN to service "UniVPN" -- your VPN name here
                if exists VPN then connect VPN
                repeat while (current configuration of VPN is not connected)
                    delay 1
                end repeat
        end tell
end tell
EOF
}

  
  

function vpn-disconnect {
/usr/bin/env osascript &lt;&lt;-EOF
tell application "System Events"
        tell current location of network preferences
                set VPN to service "UniVPN" -- your VPN name here
                if exists VPN then disconnect VPN
        end tell
end tell
return
EOF
}



Don't forget to change the name of the VPN.