Configure IPsec on Linux Machine (2024)

Install Libreswan

Configure IPsec on Linux Machine (1)

Before beginning, make sure packet forwarding is enabled on the Linux distribution.

Configure IPsec on Linux Machine (2)

To download the latest source code of Libreswan, visit the Libreswan Downloads page.

  1. Run the following commands as root:

    CODE

    yum -y updateyum -y install libnss3-dev libnspr4-dev pkg-config libpam0g-dev libcap-ng-dev libcap-ng-utils libselinux1-dev libcurl4-nss-dev flex bison gcc makeyum install wget
  2. Install Libreswan:

    CODE

    yum install libreswan
  3. Start the IPsec service and enable the service to be started:

    CODE

    systemctl enable ipsec
  4. Configure the firewall to allow 500 and 4500/UDP ports for the IKE, ESP, and AH protocols by adding the IPsec service:

Initialize the NSS Database

Configure IPsec on Linux Machine (3)

After a new installation of Libreswan, the NSS database should be initialized as part of the installation process. Before you start a new database, remove the old database.

  1. Use the following commands to remove the old database:

    CODE

    ~]# systemctl stop ipsec

    CODE

    ~]# rm /etc/ipsec.d/*db
  2. Enable IPsec:

    CODE

    systemctl enable ipsec

    Configure IPsec on Linux Machine (4)

    Libreswan requires the firewall to allow the following packets: UDP port 500 and 4500 for the Internet Key Exchange (IKE) protocol. Protocol 50 for Encapsulated Security Payload (ESP) IPsec packets. Protocol 51 for Authenticated Header (AH) IPsec packets (uncommon).

  3. Check IPsec status:

    CODE

    $ipsec setup status

    Configure IPsec on Linux Machine (5)

  4. Initialize the new NSS database, run the following command as root:

    CODE

    ~]# ipsec initnss

    Configure IPsec on Linux Machine (6)

Create Host-to-Host VPN

  1. Go to the/etc/ipsec.d/ directory and create a new my_host-to-host.conf file.
  2. Edit the file, and enter all the details shown below:

    Configure IPsec on Linux Machine (7)

    It is mandatory to maintain the gap of one tab between conn mytunnel and auto=start.

    CODE

    conn mytunnel auto=start keyexchange=ike phase2=esp pfs=no type=tunnel authby=secret leftid=(Domain name/ip of linux machine) left=(ip address of linux machine) right=(ip address of Windows machine) rightid=(Domain name of Windows machine)

    For example, see the screenshot below:

    Configure IPsec on Linux Machine (8)

    SettingValue
    Connection namemytunnel
    leftid10.1.0.127 (Linux machine)
    right

    10.1.22.59 (Windows machine)

    rightidRinkitest.QA.schq.secious.com (FQDN domain name of Windows machine)
  3. Go to the /etc folder, and make the following edits in the ipsec.secrets file:

    CODE

    (ip adddress of linux machine)<space>( ip address of windows machine)<space> : <space>PSK<space>"Shared key which we passed for Windows machine"

    Configure IPsec on Linux Machine (9)

  4. Start the IPsec service:

    CODE

    systemctl start ipsec
  5. Verify the tunnel is up and running:

    CODE

    ipsec auto --add mytunnel

    Configure IPsec on Linux Machine (10)

    Configure IPsec on Linux Machine (11)

    If you receive any error message after running the above command, you have entered the incorrect values in either your host-to-host.conf file or your ipsec.secrets file. You will need to go back and enter the correct values.

  6. Restart the IPsec service:

    CODE

    systemctl restart ipsec
  7. You have completed configuring IPsec between Windows and Linux machines.

  8. You can verify that traffic is coming in properly and is encrypted by using Wireshark:
    Configure IPsec on Linux Machine (12)
Configure IPsec on Linux Machine (2024)
Top Articles
Chrome now hides notification content when screen sharing to keep alerts private
How to Negotiate Salary with Your Employer and Get the Raise You Deserve
Faint Citrine Lost Ark
Celebrity Extra
Professor Qwertyson
Puretalkusa.com/Amac
Www Thechristhospital Billpay
What's New on Hulu in October 2023
Magic Mike's Last Dance Showtimes Near Marcus Cedar Creek Cinema
Hover Racer Drive Watchdocumentaries
Comenity Credit Card Guide 2024: Things To Know And Alternatives
Sitcoms Online Message Board
Mid90S Common Sense Media
Think Up Elar Level 5 Answer Key Pdf
Local Collector Buying Old Motorcycles Z1 KZ900 KZ 900 KZ1000 Kawasaki - wanted - by dealer - sale - craigslist
Spartanburg County Detention Facility - Annex I
Alejos Hut Henderson Tx
Uky Linkblue Login
Craigslist Red Wing Mn
White Pages Corpus Christi
Palm Springs Ca Craigslist
Pinellas Fire Active Calls
Concordia Apartment 34 Tarkov
Ge-Tracker Bond
A Biomass Pyramid Of An Ecosystem Is Shown.Tertiary ConsumersSecondary ConsumersPrimary ConsumersProducersWhich
Quick Answer: When Is The Zellwood Corn Festival - BikeHike
Brbl Barber Shop
UMvC3 OTT: Welcome to 2013!
Lost Pizza Nutrition
Bn9 Weather Radar
Craigslist Wilkes Barre Pa Pets
Wood Chipper Rental Menards
Yu-Gi-Oh Card Database
The Bold and the Beautiful
Kltv Com Big Red Box
Chattanooga Booking Report
Pensacola 311 Citizen Support | City of Pensacola, Florida Official Website
Acadis Portal Missouri
Dr Adj Redist Cadv Prin Amex Charge
A Comprehensive 360 Training Review (2021) — How Good Is It?
Ramsey County Recordease
Hireright Applicant Center Login
Oppenheimer Showtimes Near B&B Theatres Liberty Cinema 12
Achieving and Maintaining 10% Body Fat
Differential Diagnosis
Child care centers take steps to avoid COVID-19 shutdowns; some require masks for kids
Deezy Jamaican Food
Hillsborough County Florida Recorder Of Deeds
Assignation en paiement ou injonction de payer ?
Dcuo Wiki
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 6043

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.