halo / macosvpn

:wrench: Create macOS VPNs programmatically (L2TP & Cisco)
Other
442 stars 72 forks source link

Connect VPN from this tool? #27

Closed laxmansahni closed 7 years ago

laxmansahni commented 7 years ago

Hi,

I tested your code and it works fine to create a VPN interface in network settings. Can I also use same executable to establish a connection to VPN by passing some parameters?

--Laxman

halo commented 7 years ago

Hi!

This macosvpn tool only creates new VPN interfaces.

You can use scutil to start and stop those tunnels. It is shipped with macOS since Lion.

From https://superuser.com/a/736859

For example, if I have a VPN service named "Foo", I could connect via: $ scutil --nc start Foo

I can optionally specify a user, password, and secret using flags of the same names: $ scutil --nc start Foo --user bar --password baz --secret quux

The service can be disconnected via: $ scutil --nc stop Foo

For more detailed help, you can see the man page, or run: $ scutil --nc help