2.7. Securing Virtual Private Networks (VPNs)
In Red Hat Enterprise Linux 6, a Virtual Private Network (VPN) can be configured using the
IPsectunneling protocol which is supported by the Libreswan application. Libreswan is a fork of the Openswan application and examples in documentation should be interchangeable. The NetworkManager
IPsecplug-in is called NetworkManager-openswan.
Libreswan replaced Openswan as the preferred implementation of IPsec in Red Hat Enterprise Linux 6.8. Performing an upgrade from a version earlier than 6.8 replaces the openswan package with libreswan.
Libreswan is an open-source, user-space
IPsecimplementation available in Red Hat Enterprise Linux 6. It uses the Internet key exchange (IKE) protocol.
IKEversion 1 and 2 are implemented as a user-level daemon. Manual key establishment is also possible via
ip xfrmcommands, however this is not recommended. Libreswan interfaces with the Linux kernel using netlink to transfer the encryption keys. Packet encryption and decryption happen in the Linux kernel.
Libreswan uses the network security services (NSS) cryptographic library, which is required for Federal Information Processing Standard (FIPS) security compliance.
2.7.1. IPsec VPN Using Libreswan
To install Libreswan, issue the following command as
root. Note that the libreswan package is available from the Extras repository, which needs to be enabled for the installation to succeed. See How to enable/disable a repository using Red Hat Subscription Manager? (The ID of the Extras repository is
yum install libreswan
To check that Libreswan is installed, issue the following command:
yum info libreswan
After a new installation of Libreswan the NSS database should be initialized as part of the install process. However, should you need to start a new database, first remove the old database as follows:
Then, to initialize a new NSS database, issue the following command as
ipsec initnssInitializing NSS database See 'man pluto' if you want to protect the NSS database with a password
To start the
ipsecdaemon provided by Libreswan, issue the following command as
service ipsec start
To confirm that the daemon is now running:
service ipsec statuspluto (pid 3496) is running...
To ensure that Libreswan will start when the system starts, issue the following command as
chkconfig ipsec on
Configure any intermediate as well as host-based firewalls to permit the
ipsecservice. See Section 2.8, “Firewalls” for information on firewalls and allowing specific services to pass through. Libreswan requires the firewall to allow the following packets:
UDPport 500 for the
Internet Key Exchange(IKE) protocol
UDPport 4500 for
- Protocol 50 for
Encapsulated Security Payload(ESP)
- Protocol 51 for
We present three examples of using Libreswan to set up an
IPsecVPN. The first example is for connecting two hosts together so that they may communicate securely. The second example is connecting two sites together to form one network. The third example is supporting roaming users, known as road warriors in this context.