Setting up Ubuntu built-in VPN client

This guide explains how to configure the Ubuntu built-in NetworkManager L2TP VPN client to connect to your VPN gateway.

Installing required packages

Run the following commands to update your package list and install the L2TP plugin for NetworkManager:

sudo apt update
sudo apt install -y network-manager-l2tp network-manager-l2tp-gnome

Setting up a new VPN connection

  1. Click the network connection icon in the top-right corner of the desktop and click Settings. Network icon menu with Settings button

  2. In Settings, select the Network tab on the left. Click the + button next to the VPN label to add a new VPN connection. Network settings with VPN section and + button

  3. Choose Layer 2 Tunneling Protocol (L2TP) as the tunneling protocol. VPN type selection dialog with L2TP option

  4. Fill in the connection details using your user credentials:

    • Gateway: your VPN gateway IP address
    • User name: your Login
    • Password: your Password

    Click the user symbol in the password field and select Store the password only for this user. L2TP VPN connection form with gateway and credentials

  5. Click IPsec Settings… to open the IPsec configuration panel. IPsec Settings dialog

    • Check Enable IPsec tunnel to L2TP host.
    • Enter your Shared Secret in the Pre-shared key field.
    • Click Advanced and set:
      • Phase1 Algorithms: ike=aes128-sha1-modp2048
      • Phase2 Algorithms: esp=aes128-sha1
    • Click OK.
  6. Open the IPv4 tab and scroll to Routes. Add a route as shown below, then click Add. IPv4 routes configuration with 10.0.0.0/8 route Save the connection by clicking Add.

  7. Toggle the VPN connection on in Settings → Network → VPN to confirm it connects successfully. VPN toggle enabled in Network settings

On this page