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
Investing in Unethical Stocks: Pros and Cons for Traders
Factors of an Organizational Structure
Skylar Vox Bra Size
Odawa Hypixel
Chicago Neighborhoods: Lincoln Square & Ravenswood - Chicago Moms
How To Do A Springboard Attack In Wwe 2K22
Craigslist Furniture Bedroom Set
Songkick Detroit
Sinai Web Scheduler
Tribune Seymour
Autozone Locations Near Me
Xm Tennis Channel
Azeroth Pilot Reloaded - Addons - World of Warcraft
Yesteryear Autos Slang
WWE-Heldin Nikki A.S.H. verzückt Fans und Kollegen
Crossword Nexus Solver
Billionaire Ken Griffin Doesn’t Like His Portrayal In GameStop Movie ‘Dumb Money,’ So He’s Throwing A Tantrum: Report
1-833-955-4522
Kcwi Tv Schedule
Dr Ayad Alsaadi
Menus - Sea Level Oyster Bar - NBPT
Thick Ebony Trans
Cookie Clicker Advanced Method Unblocked
Skidware Project Mugetsu
Core Relief Texas
Mobile crane from the Netherlands, used mobile crane for sale from the Netherlands
Alima Becker
Gr86 Forums
Ixl Lausd Northwest
Pitco Foods San Leandro
Muma Eric Rice San Mateo
Die Filmstarts-Kritik zu The Boogeyman
craigslist | michigan
Directions To Advance Auto
sacramento for sale by owner "boats" - craigslist
Lbl A-Z
Sas Majors
The Conners Season 5 Wiki
Gopher Hockey Forum
Lamp Repair Kansas City Mo
Ds Cuts Saugus
Walgreens On Secor And Alexis
Ehome America Coupon Code
Uc Davis Tech Management Minor
Thothd Download
De boeken van Val McDermid op volgorde
antelope valley for sale "lancaster ca" - craigslist
Vcuapi
Bumgarner Funeral Home Troy Nc Obituaries
Tamilyogi Cc
Guidance | GreenStar™ 3 2630 Display
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.