skip to primary navigationskip to content
 

Ubuntu 16.04 Desktop

Configuring the UIS VPN or Ubuntu 16.04 LTS Desktop

Caution! Due to the wide variations in Linux these instructions are likely to be incompatible, or require adaptation to work, with other versions of Ubuntu.

Generic instructions for configuring the VPN service are provided, which may be helpful when setting up alternative systems.

Important note: The following are best-efforts instructions provided by a user and will allow the VPN service be used from Ubuntu 16.04 (and, possibly, other releases).  Unfortunately, due to bugs in Ubuntu 16.04, the setup and control of the VPN must be performed using the command line (Terminal); if you are unsure about this process, please seek assistance from someone familiar with Linux.

You'll need root access to your machine.  All the steps below assume you are using a root shell (or know how to use "sudo" to execute commands as root) and have a reasonable familiarity with Linux (utilities, filesystem, editors, etc.)

For general information on configuration, see our generic instructions and information on our managed VPN service.

Install the StrongSwan packages

Various packages are required to support the VPN, from the strongswan family.  They should be installed using "apt-get":

sudo apt-get install strongswan strongswan-libcharon strongswan-plugin-eap-mschapv2*

VPN configuration file — ipsec.conf

This is the main configuration file of strongswan, in /etc/ipsec.conf. It should read as follows, substituting "username" with your CRSid (e.g. "xyz789"), leaving the "@cam.ac.uk" on the end.

conn %default
  keyexchange=ikev2
  ikelifetime=60m
  keylife=20m
  rekeymargin=3m
  keyingtries=1

# The primary University VPN service.
#
conn CAM
  left=%any
  leftid="username@cam.ac.uk"
  leftauth=eap
  leftsourceip=%config
  leftfirewall=yes
#
  right="vpn.uis.cam.ac.uk"
  rightid="CN=vpn.uis.cam.ac.uk"
  rightcert=/etc/ipsec.d/certs/vpn-server-cert.crt
rightsubnet=0.0.0.0/0
#
auto=add

# The Managed VPN Service for your Institution
#
# This section should only be included if you are using a managed VPN.
# Changed "BOTOLPHS" to the name of your institution.
#
# This section can be duplicated, if you use multiple managed VPNs, but a
# different name must be used for each, to distinguish them when
# connecting.
#
#conn BOTOLPHS
#  left=%any
#  leftid="username@cam.ac.uk"
#  leftauth=eap
#  leftsourceip=%config
#  leftfirewall=yes
# #
# # 1. Replace "vpn.botolophs.cam.ac.uk" with the hostname of the particular service.
# # 2. Replace "botolphs-vpn.crt" with the filename of the downloaded certificate (the
# # filename needs to match the one used in the "Certificate" section, below).
# #
#  right="vpn.botolphs.cam.ac.uk"
#  rightid="CN=vpn.botolphs.cam.ac.uk"
#  rightcert=/etc/ipsec.d/certs/botolphs-vpn.crt
#  rightsubnet=0.0.0.0/0
# #
#  auto=add

VPN password file — ipsec.secrets

This contains the "password" (which is actually your network token, see https://tokens.csx.cam.ac.uk/). It should read as follows, substituting "username" with your own CRSid and "token" with your token:

# This file holds shared secrets or RSA private keys for authentication.
# RSA private key for this host, authenticating it to any other host
# which knows the public part.

# ipsec.secrets - strongSwan IPsec secrets file
username@cam.ac.uk : EAP "token"

Certificate

A copy of the server's certificate is required so that the client can authenticate the identity of the server, before supplying your username and password (token).

Download links for the certificates for the UIS VPN and the managed VPNs are available on the generic instructions page and the managed VPN page, respectively.  You MUST put your certificates in /etc/ipsec.d/certs – this is the only place that charon (part of the strongswan VPN software) can read.

You can download the certificate using a browser and move it into place, or use a utility such as wget:

sudo wget -O /etc/ipsec.d/certs/vpn-server-cert.crt http://help.uis.cam.ac.uk/devices-networks-printing/remote-access/uis-vpn/certs/vpn-server-cert

If you're using a managed VPN, connection, you will need to adapt the above line as required (changing the download filename to match the one you entered into the configuration above, plus using the appropriate download link for the certificate).

Connecting and Disconnecting

To connect and disconnect from the VPN, you must use a command line (in a Terminal window).

You only need to do a 'restart' after changing configuration files (perhaps during the setup above).  You then use the 'up' or 'down' commands to start or stop the VPN connection itself, as required.  For example:

sudo ipsec restart
sudo ipsec up CAM
sudo ipsec down CAM

Replace "CAM" with "BOTOLPHS" (or other) to use an institutional Managed VPN.

Debugging

  • Check /var/log/syslog for messages.
  • Put charondebug="all" in the ipsec.conf configuration file.

Last updated: 15th March 2017.