How to setup a VPN using vpnc on Linux


You first need to install vpnc:

sudo apt-get install vpnc

Following that you can directly invoke vpnc (it requires sudo):

sudo vpnc
… and answer the prompts as shown below (mutatis mutandis):
$ sudo vpnc
Enter IPSec gateway address: <enter the server address>
Enter IPSec ID for <this is the group name (ask you network admins)>
Enter IPSec secret for perdikeasm@ <the password for the group (again ask the network admins)>
Enter username for < your username >
Enter password for perdikeasm@ < your password>

In my case the network admins provided the values they had to provide in a CfA email on 2016-12-16.

You can then disconnect with:

sudo vpnc-disconnect

To avoid having to manually enter all this information I did the following:

sudo -i
cp /etc/vpnc/default.conf /etc/vpnc/myvpn.conf
\emacs -nw /etc/vpnc/myvpn.conf
And basically set the above values in the myvpn.conf file (remember to uncomment the lines).
NB: I had to keep the line that read: IKE Authmode hybrid commented as I was getting this problem.

Once you have the myvpn.conf file properly setup you can then simply do:

sudo vpnc myvpn.conf
(without having to be in the /etc/vpnc/ directory)

To bring down the VPN do sudo vpnc-disconnect like before.

For added security (if you are that type of person) you may leave the password line commented as well, this way you'll be prompted for the password each time.