docker pull fcojean/l2tp-ipsec-vpn-server
创建env
vi vpn.env
VPN_IPSEC_PSK=nonnix.com
VPN_USER_CREDENTIAL_LIST=[{"login":"uesr","password":"ssfq"},{"login":"tsi","password":"ssfq"},{"login":"vpn","password":"ssfq"}]
加载 IPsec NETKEY 内核模块
modprobe af_key
加载env配置文件,将对应端口与服务器端口绑定
docker run \
--name l2tp-ipsec-vpn-server \
--env-file ./vpn.env \
-p 500:500/udp \
-p 4500:4500/udp \
-v /lib/modules:/lib/modules:ro \
-d --privileged \
fcojean/l2tp-ipsec-vpn-server
查看VPN状态
docker logs vpn-server
查看和关闭防火墙,需开放500端口和4500端口
systemctl status firewalld
systemctl stop firewalld