How To Install libreswan on CentOS 7

In this tutorial we learn how to install libreswan on CentOS 7. libreswan is IPsec implementation with IKEv1 and IKEv2 keying protocols

Introduction

In this tutorial we learn how to install libreswan on CentOS 7.

What is libreswan

Libreswan is a free implementation of IPsec & IKE for Linux. IPsec is the Internet Protocol Security and uses strong cryptography to provide both authentication and encryption services. These services allow you to build secure tunnels through untrusted networks. Everything passing through the untrusted net is encrypted by the ipsec gateway machine and decrypted by the gateway at the other end of the tunnel. The resulting tunnel is a virtual private network or VPN. This package contains the daemons and userland tools for setting up Libreswan. It supports the NETKEY/XFRM IPsec kernel stack that exists in the default Linux kernel. Libreswan also supports IKEv2 (RFC-7296) and Secure Labeling Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04

We can use yum or dnf to install libreswan on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install libreswan.

Install libreswan on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install libreswan using yum by running the following command:

sudo yum -y install libreswan

Install libreswan on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install libreswan using dnf by running the following command:

sudo dnf -y install libreswan

How To Uninstall libreswan on CentOS 7

To uninstall only the libreswan package we can use the following command:

sudo dnf remove libreswan

References

Summary

In this tutorial we learn how to install libreswan on CentOS 7 using yum and dnf.