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
CFA Jobs & Salaries In India After CFA Level 1, Level 2 & Level 3
About Oracle Database Release Numbers
Exclusive: Baby Alien Fan Bus Leaked - Get the Inside Scoop! - Nick Lachey
Odawa Hypixel
Dollywood's Smoky Mountain Christmas - Pigeon Forge, TN
Pga Scores Cbs
Seething Storm 5E
Merlot Aero Crew Portal
Swimgs Yung Wong Travels Sophie Koch Hits 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Springs Cow Dog Pig Hollywood Studios Beach House Flying Fun Hot Air Balloons, Riding Lessons And Bikes Pack Both Up Away The Alpha Baa Baa Twinkle
Knaben Pirate Download
Reddit Wisconsin Badgers Leaked
Aucklanders brace for gales, hail, cold temperatures, possible blackouts; snow falls in Chch
Nesz_R Tanjiro
Band Of Loyalty 5E
Craigslist Southern Oregon Coast
Epguides Strange New Worlds
Ge-Tracker Bond
Melissababy
Veracross Login Bishop Lynch
John Chiv Words Worth
C&T Wok Menu - Morrisville, NC Restaurant
Play Tetris Mind Bender
Olivia Maeday
Defending The Broken Isles
Mals Crazy Crab
§ 855 BGB - Besitzdiener - Gesetze
Margaret Shelton Jeopardy Age
Gillette Craigslist
Truck from Finland, used truck for sale from Finland
Movies - EPIC Theatres
130Nm In Ft Lbs
The Posturepedic Difference | Sealy New Zealand
APUSH Unit 6 Practice DBQ Prompt Answers & Feedback | AP US History Class Notes | Fiveable
Helloid Worthington Login
Kids and Adult Dinosaur Costume
Truis Bank Near Me
Reli Stocktwits
Chattanooga Booking Report
T&J Agnes Theaters
Craigslist Lakeside Az
Ludvigsen Mortuary Fremont Nebraska
Flags Half Staff Today Wisconsin
Gfs Ordering Online
Hkx File Compatibility Check Skyrim/Sse
Sacramentocraiglist
Erespassrider Ual
Concentrix + Webhelp devient Concentrix
Diccionario De Los Sueños Misabueso
March 2023 Wincalendar
Obituary Roger Schaefer Update 2020
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.