oskernel/l2tp VPN server instanceYou must define some essential environment variables either by creating /etc/l2tp.env file or by passing the variables directly to docker cli.
Following is an example of /etc/l2tp.env file:
VPN_IPSEC_PSK=yourpsk
VPN_USER=defaultuser
VPN_PASSWORD=defaultpassword
VPN_PUBLIC_IP=
VPN_L2TP_NET=
VPN_L2TP_LOCAL=
VPN_L2TP_REMOTE=
VPN_DNS1=
VPN_DNS2=
VPN_SHA2_TRUNCBUG=
VPN_IPSEC_PSK: IPSec Pre-Shared Key
VPN_USER: default username
VPN_PASSWORD: the password of the default username specified by VPN_USER
VPN_PUBLIC_IP: public IP (need to be specified if you have two or more public IP)
VPN_L2TP_NET: private network (default: 192.168.18.0/24)
VPN_L2TP_LOCAL: local(private) ip (default: 192.168.18.1)
VPN_L2TP_REMOTE: IP range of the VPN connections (default: 192.168.18.10-192.168.20.250)
VPN_DNS1, VPN_DNS2: DNS servers (default: 8.8.8.8, '8.8.4.4)
VPN_SHA2_TRUNCBUG: If you encounter connection issues while using Android, you may set this variable to yes. (default: no)
If you want to allow inbound connections to the VPN behind Firewall or NAT, you must open or forward port 500 & 4500.
You can start a simple instance using following examples.
/etc/l2tp.env file:# docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --name l2tp --restart=always \
--env-file /etc/l2tp.env \
-v /lib/modules:/lib/modules \
oskernel/l2tp
# docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --name l2tp --restart=always \
-v /lib/modules:/lib/modules \
-e VPN_IPSEC_PSK=defaultpsk \
-e VPN_USER=defaultuser \
-e VPN_PASSWORD=defaultpassword \
oskernel/l2tp
You may issue a command like following when you would like to check if the VPN service is doing well. (assuming the name of the container is l2tp)
# docker logs l2tp
And then, probably you can get the output like below if there is not any erroneous configurations.
L2TP/IPsec VPN Server with the Username and Password is below:
Server IP: [Your Public IP]
IPSec PSK: [Your PSK]
Username : [Your Default User Name]
Password : [Your Password of the Default User]
Starting pluto IKE daemon for IPsec: .
xl2tpd[1]: Not looking for kernel SAref support.
xl2tpd[1]: Using l2tp kernel support.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.18 started on 36e86dd1c3c9 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006-2016
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
Content type
Image
Digest
sha256:cb6ab6017…
Size
90.3 MB
Last updated
over 1 year ago
docker pull oskernel/l2tp