Hostxpeed
Login Get Started →
Security

How to Set Up IPSec

6 min read
25 views
Jun 10, 2026

Step 1: Install StrongSwan

sudo apt update && sudo apt install strongswan strongswan-pki libcharon-extra-plugins libcharon-extauth-plugins -y

Step 2: Generate Certificates

pki --gen --type rsa --size 4096 --outform pem > server-key.pem
pki --self --ca --lifetime 3650 --in server-key.pem --dn "CN=VPN Server" --outform pem > server-cert.pem

Step 3: Configure ipsec.conf

sudo nano /etc/ipsec.conf

Step 4: Set Up Authentication

sudo nano /etc/ipsec.secrets

Step 5: Start StrongSwan

sudo systemctl start strongswan-starter
sudo systemctl enable strongswan-starter

Was this article helpful?