Self-host docker-ipsec-vpn-server
IPsec VPN server image for L2TP, Cisco IPsec and IKEv2
docker run --name ipsec-vpn-server --env-file ./vpn.env --restart=always -v ikev2-vpn-data:/etc/ipsec.d -v /lib/modules:/lib/modules:ro -p 500:500/udp -p 4500:4500/udp -d --privileged hwdsl2/ipsec-vpn-server- Stars
- 7 158
- Ports
- 500 (IPsec), 4500 (IPsec)
hwdsl2/ipsec-vpn-serverWhat is docker-ipsec-vpn-server?
This project packages an IPsec VPN server as a Docker image, built with Libreswan as the IPsec stack and xl2tpd for L2TP on either an Alpine or a Debian base. It serves three tunnel modes out of the box — IPsec/L2TP with a pre-shared key, IKEv1 XAuth (the "Cisco IPsec" style) and IKEv2 — so laptops, phones and tablets can reach the internet through an encrypted tunnel instead of an untrusted network such as hotel or airport Wi-Fi. On first start it creates VPN credentials and the IKEv2 configuration by itself, and it exports device profiles that let iOS, macOS and Android set up the connection automatically; a bundled ikev2.sh helper adds, lists and exports IKEv2 clients and certificates. Everything needed to log in (server address, PSK, username, password) is printed to the container log, and state such as certificates lives in a Docker volume so the container can be recreated without losing it. Extra VPN accounts, custom client DNS, static client addresses, split tunneling, IPv6 for IKEv2 and disabling individual tunnel modes are all driven by an optional env file. You run it by pulling hwdsl2/ipsec-vpn-server and starting it as a privileged container (an unprivileged variant with NET_ADMIN is documented too), or with the included compose file; UDP 500 and 4500 must be reachable, and amd64, arm64 and arm/v7 are all supported. Limits to note: Docker for Windows and Synology NAS are not supported, several devices behind one NAT need IKEv2 or XAuth rather than shared L2TP accounts, and the source is licensed under Creative Commons BY-SA 3.0 rather than a conventional software licence.
docker-ipsec-vpn-server alternatives
Self-Hosted GatewayOpen-source alternative to Cloudflare Tunnels using WireGuard, NGINX, and Caddy to expose local Docker containers without port forwarding.CompareSelf-Hosted Gateway with docker-ipsec-vpn-server
PritunlSelf-hosted distributed VPN server for OpenVPN, WireGuard and IPsec with a web console, SSO and 2FA, MongoDB-backed clustering and site-to-site links.ComparePritunl with docker-ipsec-vpn-server
Vaultwarden_Self_HostSelf-hosted password manager using Vaultwarden with automated Docker deployment, nginx HTTPS proxy, backups, and private CA for trusted HTTPS.CompareVaultwarden_Self_Host with docker-ipsec-vpn-server
openvpn-asSelf-hosted OpenVPN Access Server packaged as a Docker image with a web-based VPN management interface.Compareopenvpn-as with docker-ipsec-vpn-server
gluetunVPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.Comparegluetun with docker-ipsec-vpn-server
SoftEtherVPNOpen-source self-hosted VPN server supporting SSL-VPN, WireGuard, OpenVPN, IPsec, L2TP, SSTP and EtherIP in one program, running on Windows, Linux, FreeBSD and Solaris.CompareSoftEtherVPN with docker-ipsec-vpn-server
super📡 SPR: Open Source, secure, user friendly and fast wifi routers for your home. One wifi password per device. Ad Blocking & Privacy Blocklists. Policy Based Network AccessComparesuper with docker-ipsec-vpn-server
towoneltowonel is an open-source, self-hosted tunnel exposing HTTP(S), TCP, and UDP services behind NAT or CGNAT without inbound ports, using a persistent QUIC tunnel.Comparetowonel with docker-ipsec-vpn-server
Should you self-host docker-ipsec-vpn-server?
docker-ipsec-vpn-server scores 64/100 on selfhost.directory (how scoring works) and ranks #17 of 56 in VPN. It has 7 158 GitHub stars, +14 in the last 30 days.
There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.
Setup is easy: most people get it running in one sitting. An official Docker image is available. It is Other-licensed and written mostly in Shell.
Its closest alternative on selfhost.directory is Tailscale (84/100, 38 805 stars). It scores higher overall, so compare the two before you pick. See docker-ipsec-vpn-server vs Tailscale side by side.
Features
- Automatic credential and config generation
- Configurable client DNS
- Device provisioning profiles
- IKEv1 XAuth (Cisco IPsec) VPN
- IKEv2 client management script
- IKEv2 VPN
- IPsec/L2TP VPN
- IPv6 support for IKEv2 clientsIKEv2 mode only
- Multiple VPN users
- Per-mode enable/disable
- Persistent state via Docker volume
- Split-tunnelingIKEv2 mode
- Static client IP assignment
- Unprivileged container mode
docker-ipsec-vpn-server README
English | 简体中文 | 繁體中文 | Русский
Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2.
Based on Alpine 3.23 or Debian 12 with Libreswan (IPsec VPN software) and xl2tpd (L2TP daemon).
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.
More in VPN
docker-openvpnSelf-hosted OpenVPN Docker image with auto PKI, client management, dual-stack IPv4/IPv6, and modern ciphers.
Docker ZeroTier PlanetA self-hosted ZeroTier Planet you deploy with Docker on a Linux server, with a web management UI for networks and members plus planet/moon file downloads.
dockovpnDockoVPN is a self-hosted open-source Dockerized OpenVPN server that starts in under 2 seconds without persistent storage requirements.
FireflyFirefly is a self-hosted WireGuard VPN server with web UI for managing clients. Runs as a single binary or Docker container, supports Let's Encrypt SSL and TCP relay.
FirezoneZero-trust remote access built on WireGuard for teams: gateways run in your network, while policies, device trust and audit logs are managed from a hosted portal.
GateKeySelf-hosted zero-trust VPN wrapping OpenVPN and WireGuard with SSO login, short-lived certs, and per-user firewall rules for least-privilege access.
gateway-gogateway-go is a self-hosted, open-source LAN gateway that pairs with OpenIoTHub client via QR code to expose local ports over NAT traversal and P2P tunnels.
gluetunVPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
gravitlSelf-hosted, open-source WireGuard automation: mesh VPNs, remote access gateways and site-to-site networks managed from a web UI with ACLs and DNS.
HeadplaneSelf-hosted, open-source web admin panel for Headscale, the open Tailscale control server: nodes, ACLs, DNS, SSO and browser SSH.
headscaleSelf-hosted, open-source Tailscale control server for personal and small org tailnets with WireGuard VPN, MagicDNS, and ACLs.
headscale-adminSelf-hosted web UI for headscale (Tailscale control server). Manage users, nodes, routes, ACLs via static files in Docker or any web server.
0 comments