📈 GH Trending Explorer 🎲 Surprise me

← all repos

hwdsl2 / setup-ipsec-vpn

git clone https://github.com/hwdsl2/setup-ipsec-vpn.git

Set up your own IPsec VPN server in just a few minutes, with IPsec/L2TP, Cisco IPsec and IKEv2. Supports Ubuntu, Debian, CentOS/RHEL, Alpine Linux and Raspberry Pi OS. Includes client config and management scripts.

+13
stars, 24h · #2,804
+~70
stars, 7 days · #2,994
+~300
stars, 30 days · #2,717
29k
★ total · +0% this week
6.5k
forks · 1 open issues

Star history (as recorded here)

2026-10-20 · 28,789 ★ 2026-10-23 · 28,819 ★
LanguageShell
License—
Created2016-01-07 (10y ago)
Last push2d ago
Watchers652
OwnerUser

GitHub topics

Links

README excerpt
English | 简体中文 | 繁體中文 | 日本語 | Русский
# IPsec VPN Server Auto Setup Scripts
Set up your own IPsec VPN server in just a few minutes, with IPsec/L2TP, Cisco IPsec and IKEv2.
An IPsec VPN encrypts your network traffic, so that nobody between you and the VPN server can eavesdrop on your data as it travels via the Internet. This is especially useful when using unsecured networks, e.g. at coffee shops, airports or hotel rooms.
We will use Libreswan as the IPsec server, and xl2tpd as the L2TP provider.
**Features:**
- Fully automated IPsec VPN server setup, no user input needed
- Supports IKEv2 with strong and fast ciphers (e.g. AES-GCM)
- Generates VPN profiles to auto-configure iOS, macOS and Android devices
- Supports Windows, macOS, iOS, Android, Chrome OS and Linux as VPN clients
- Includes helper scripts to manage VPN users and certificates
**Also available:**
- Docker VPN: IPsec VPN, WireGuard, OpenVPN, Headscale
- AI: Self-Hosted AI Stack for local LLMs, chat, RAG, voice and AI tools
> 📘 Interested in self-hosted AI? The Self-Hosted AI Builder’s Guide is a practical guide to building, securing, and operating your own private AI stack. **Ebook: $0.99 for a limited time.**
## Quick start
Start with a Linux server\* running a supported operating system.
Use this one-liner to set up an IPsec VPN server:
 [code] 
Your VPN login details will be randomly generated, and displayed when finished.
**Tip:** Optionally install WireGuard, OpenVPN and/or Headscale on the same server.
See the script in action (terminal recording).
**Note:** This recording is for demo purposes only. VPN credentials in this recording are **NOT** valid.
Click here if you are unable to download.
You may also use `curl` to download:
 [code] 
Alternative setup URLs:
 [code] 
If you are unable to download, open vpnsetup.sh, then click the `Raw` button on the right. Press `Ctrl/Cmd+A` to select all, `Ctrl/Cmd+C` to copy, then paste into your favorite editor.
A pre-built Docker image is also available. For other options and client setup, read the sections below.
\* A cloud server, virtual private server (VPS) or dedicated server.
## Community
- 📬 Get project updates and free deployment guides (1–2 emails/month)
- 💬 Join the r/selfhostedstack community for discussions
- ⭐ Star the repository if you find it useful — it helps others discover it
## Requirements
A cloud server, virtual private server (VPS) or dedicated server, with an install of:
- Ubuntu 26.04, 24.04 or 22.04
- Debian 13 or 12
- CentOS Stream 10 or 9
- Rocky Linux or AlmaLinux
- Oracle Linux
Other supported Linux distributions.
- Raspberry Pi OS (Raspbian)
- Kali Linux
- Alpine Linux
- Red Hat Enterprise Linux (RHEL)
This also includes Linux VMs in public clouds, such as DigitalOcean, Vultr, Linode, OVH and Microsoft Azure. Public cloud users can also deploy using user data.
Quick deploy to:
**» I want to run my own VPN but don't have a server for that**
For servers with an external firewall (e.g. EC2/GCE), open UDP ports 5