I have a macbook pro with mavericks running. I am looking for a way to connect to a VPN network in terminal.
The reason why I want to do this is that I want to write a small program in Python which automatically detects the fastest VPN server among 30 servers. This is a self-motivated practicing project so I think I'll stick to Python language. So I break down the task and think the program may need to connect to one of the server first and after that, run a speed test.
So I'm now stuck in this first step because I realised establishing a VPN connection seems to be under system level because I can't find pre-written VPN module in python. So I guess it will be like I tell Python to tell system shell to connect to a VPN server.
As I poking around and I found a command by typing apropos vpn
. It's called vpnagent
. But man vpnagent
doesn't provide useful information nor which vpnagent
tells me the utility is not installed in my Mac. Another interesting thing I found was pppd
but setting up the configuration file was very frustrating. I didn't manage to do that.
So is there a way of connecting to VPN using terminal? In addition, since I'm new to programming, any comment on my project is also welcome. Thank you in advance.
Best Answer
You can use these wonderful bash functions from @slhck at Super User:
To connect to different VPNs, have multiple VPNs in Network.prefpane.
Don't forget to change the name of the VPN.