skip to content

IT Help and Support

University Information Services
 

Configuring the UIS VPN on Ubuntu 20.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 the UIS Servers and Storage team and will allow the VPN service be used from Ubuntu 20.04.

Unfortunately, due to some limitations in Ubuntu, 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. 

StrongSwan is available for other distributions, and this document may help you with the setup of StrongSwan once you have obtained suitable packages for your distribution.

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.

Periodically, the certificate used by the VPN server will need to be updated.  When this happens, you'll need to download and install the new server certificate and restart the ipsec service to reconnect. In this case, follow the instructions from the certificate section onwards.
 

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 -y strongswan libstrongswan-extra-plugins libstrongswan-standard-plugins libcharon-extra-plugins resolvconf

 

VPN configuration file — ipsec.conf

The contents of ubuntu2020-ipsec should be inserted into /etc/ipsec.conf, just underneath the section starting "config setup".  Substitute "username" with that of the Network Access Token you created for this device in the format CRSid+device@cam.ac.uk – for example "abc123+myhomelaptop@cam.ac.uk":

 

VPN password file — ipsec.secrets

The file /etc/ipsec.secrets needs to have the following two lines appended.  Replace "username" with the Network Access Token username (as above) and "token" with the password, for this device:

# 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 https://help.uis.cam.ac.uk/system/files/documents/vpn.crt

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).

Note that this will need to done in the event of the server certificate changing.  The client changeover must be done in coordination with the certificate changing on the server: it cannot be done in advance, nor later — if the certificates mismatch, the VPN will not connect.
 

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 (e.g. during the setup above, or updating the certificate).  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.
  • Periodically, the certificate used by the VPN server will need to be updated. When this happens, you will need to download and install the new server certificate and restart the ipsec service to reconnect. In this case, follow the instructions from the certificate section onwards.
  • If you see intermittent hangs, you may have an MTU mismatch. You can sometimes solve this by setting the MTU of your network device – that is, change enp4s0 as required in the following statement:

ip link set dev enp4s0 mtu 1422

 

Last updated: 22 February 2021

UIS Service Desk

UIS Service Status

Phone padded  Service status line: (01223 7)67999
Website  Sign up for SMS/email status alerts
Website  Read major IT incident reports

UIS bITe-size bulletin

A regular newsletter aimed at the University's IT community, highlighting service and project news from UIS.

Sign up >

Latest news

University Wireless Service maintenance: Tuesday 21 September, 08:00–09:00

16 September 2021

The University Wireless Service will be undergoing essential maintenance between 08:00 and 09.00 on Tuesday 21 September while we apply a security software patch. This is a security update to ClearPass, which provides Wireless Service network access control. We're not expecting any disruption to service, but it should be...

Mailing list migrations from Mailman to Sympa

31 August 2021

We intend to migrate all remaining lists associated with colleges from Mailman to Sympa during the week commencing 13 September 2020. The current total is 1,567. How this will affect users of the mailing list management service Most mailing list subscribers shouldn't notice any difference. During the switchover, there will...

Managed Zone Service closedown and migration to Mythic Beasts

24 August 2021

The Managed Zone Service (MZS) is being shut down, and its data content migrated to a commercial provider, Mythic Beasts. There will be no interruption to the service, but MZS users in institutions will need to make arrangements to retain management access to their zones. What is changing? UIS set up the MZS many years ago...