How to Setup an L2TP/IPsec VPN Client on Linux

[‘

n

L2TP (which stands for Layer 2 Tunneling Protocol) is a tunneling protocol designed to support virtual private networks (VPN connections) over the internet. It is implemented in most if not all modern operating systems including Linux and VPN-capable devices.

n

The L2TP does not provide any authentication or encryption mechanisms directly to traffic that passes through it, it is usually implemented with the IPsec authentication suite (L2TP/IPsec) to provide encryption within the L2TP tunnel.

n

In this article, we will show how to set up an L2TP/IPSec VPN connection in Ubuntu and its derivatives and Fedora Linux.

n

This guide assumes that the L2TP/IPsec VPN server has been set up and that you have received the following VPN connection details from your organization’s or company’s system administrator.

n

Gateway IP address or hostnamernUsername and PasswordrnPre-shared Key (Secret)rn

n

How to Setup L2TP VPN Connection in Linux

n

To add an L2TP/IPsec option to the NetworkManager, you need to install the NetworkManager-l2tp VPN plugin which supports NetworkManager 1.8 and later. It provides support for L2TP and L2TP/IPsec.

n

To install the L2TP module on Ubuntu and Ubuntu-based Linux distributions, use the following PPA.

n

$ sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tprn$ sudo apt-get updatern$ sudo apt-get install network-manager-l2tp  network-manager-l2tp-gnomern

n

On RHEL/CentOS and Fedora Linux, use the following dnf command to install L2TP module.

n

# dnf install xl2tpdrn# dnf install NetworkManager-l2tprn# dnf install NetworkManager-l2tp-gnomernORrn# yum install xl2tpdrn# yum install NetworkManager-l2tprn# yum install NetworkManager-l2tp-gnomern

n

Once the package installation is complete, click on your Network Manager icon, then go to Network Settings.

n

Access Network Settings
Access Network Settings

n

Next, add a new VPN connection by clicking on the (+) sign.

n

Add New VPN Connection
Add New VPN Connection

n

Then select Layer 2 Tunneling Protocol (L2TP) option from the pop-up window.

n

Select Layer 2 Tunneling Protocol
Select Layer 2 Tunneling Protocol

n

Next, enter the VPN connection details (gateway IP address or hostname, username and password) you received from the system administrator, in the following window.

n

Add VPN Details
Add VPN Details

n

Next, click IPsec Settings to enter the pre-shared key for the connection. Then enable IPsec tunnel to L2TP host, enter (or copy and paste the) the Pre-shared key and click Ok.

n

Add Pre-shared Key
Add Pre-shared Key

n

After that, click Add. Now your new VPN connection should be added.

n

VPN Connection Created
VPN Connection Created

n

Next, turn on the VPN connection to start using it. If the connection details are correct, the connection should be established successfully.

n

Enable VPN Connection
Enable VPN Connection

n

Enabled VPN Connection
Enabled VPN Connection

n

Last but not least, test if the VPN is working fine. You can check your computer’s public IP address to confirm this from a web browser: it should now point to the IP of the gateway.

n

Confirm Your VPN Connection
Confirm Your VPN Connection

n

That’s the end of this article. If you have any queries or thoughts to share, reach us via the feedback form below.

n

‘]