1. 安装 docker 略
2. 在当前目录建立配置文件 l2tp.env
内容:
# Define your own values for these variables
# - IPsec pre-shared key, VPN username and password
# - DO NOT put quotes around values, or add space around '='
# - DO NOT use these characters within values: \ " '
VPN_IPSEC_PSK=test_shared_secret_key
# Table of user object with login and password attribute in Json format
VPN_USER_CREDENTIAL_LIST=[{"login":"userTest1","password":"test1"},{"login":"userTest2","password":"test2"}]
VPN_NETWORK_INTERFACE=eth0
#VPN_DNS1=192.168.0.1
#VPN_DNS2=192.168.0.1
请自行修改密钥与用户
3. sudo modprobe af_key
4. 启动容器
sudo docker run --name l2tp --env-file ./l2tp.env --restart=always -p 500:500/udp -p 4500:4500/udp -p 1701:1701/udp -v /lib/modules:/lib/modules:ro -d --privileged fcojean/l2tp-ipsec-vpn-server
会自动下载镜像,容器启动后,不出意外应该已经可以连接了
可通过 docker logs l2tp 验证是否启动成功