This episode assembles a production-ready L2TP/IPsec deployment: a checklist for key management, firewall, certificate renewal, backup, disaster recovery, and monitoring, plus deployment options in Docker containers on top of the Libreswan, xl2tpd, and ppp stack.

All the lab configurations are mastered. Episode 21 raises the bar: what must be met for an L2TP/IPsec deployment to deserve the label production-ready — not just functional, but also secure, monitored, and able to recover from failure.
We will dissect the production checklist across seven aspects: key management, firewall, certificate renewal, backup, disaster recovery, monitoring, and deployment options in containers. By the end of the episode, you will have an evaluation framework for every running deployment.
All secrets must be managed centrally, not scattered in files:
ipsec.secrets and chap-secrets is restricted to root only.Audit the firewall rules as part of the change process:
sudo ss -ulnp
sudo nft list rulesetMake sure only UDP 500, 4500, and 1701 are open, plus SSH from trusted subnets. No other ports are exposed to the internet.
Certificates must be renewed automatically and monitored. Backups must include everything needed to rebuild the server: the configuration in /etc/ipsec.conf, /etc/xl2tpd/, /etc/ppp/, the NSS database at /etc/ipsec.d/, and the chap-secrets records. Test recovery on a bare machine periodically — a backup that is never tested is the same as no backup.
Enable monitoring for the core metrics:
Standard monitoring tools:
ipsec statusall | grep -c "up "
ip -s link show ppp0
sudo journalctl -u strongswan | grep -i "failed"Use Prometheus and Grafana for large scale, with the IPsec exporters available in the open-source ecosystem. Do not forget alerting: create alerts for tunnels down for more than a few minutes and certificates with less than 30 days remaining. Start simple — run ipsec statusall via cron every minute and log the SA count; this simple historical data is already enough to detect trends before a problem grows.
A mature production stack combines everything you have learned: Libreswan or strongSwan as IPsec, xl2tpd as LNS, ppp for sessions, FreeRADIUS for authentication, and LDAP as the user directory. All behind a firewall, with HA and monitoring.
Containers make consistency and scale easier. Images such as docker-vpn bundle IPsec and xl2tpd. An example docker-compose.yml:
services:
vpn:
image: hwdsl2/ipsec-vpn-server:latest
container_name: l2tp-ipsec
privileged: true
restart: unless-stopped
ports:
- "500:500/udp"
- "4500:4500/udp"
environment:
VPN_IPSEC_PSK: "${VPN_IPSEC_PSK}"
VPN_USER: "${VPN_USER}"
VPN_PASSWORD: "${VPN_PASSWORD}"
volumes:
- vpn-libreswan:/etc/ipsec.d
- vpn-libreswan:/etc/ipsec.d/private
volumes:
vpn-libreswan:The image requires privileged because the IPsec modules need kernel access. Secrets come from the environment or vault, not committed to the repository.
Warning
Deploying IPsec in a container requires kernel privileges and the xfrm module on the host. Test on a lab host first before moving to production.
Episode 21 assembled the production-ready framework: a key management, firewall, certificate, backup, and DR checklist; monitoring of core metrics with alerting; and native or container deployment options.
Key takeaways:
In episode 22 — the final episode — we will discuss the alternative ecosystem and closing reflection: comparing L2TP/IPsec with OpenVPN, WireGuard, and pure IKEv2, recapping the whole journey, and providing a checklist and migration advice.