Docker earley-stage image to run an IPsec VPN client, with IPsec/L2TP, based on : https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md
After cloning the repo build docker image with the command
docker build -t chenhw2/ipsec-client .
In order to run the container the following environment variables need to be passed:
VPN_IPSEC_PSK, VPN_USER, VPN_PASSWORD provided from your VPN providerVPN_SERVER_ADDRVPN_LOCAL_GW_NETThen container launch would look like:
# ipsec.env
VPN_SERVER_ADDR=example.ipsec.net
VPN_IPSEC_PSK=psk
VPN_USER=user
VPN_PASSWORD=password
VPN_LOCAL_GW_NET=172.16.0.0/12
docker run --rm --name ipsec-client --env-file=ipsec.env --privileged -v=/lib/modules:/lib/modules:ro -p=8080:8080 chenhw2/ipsec-client
Test:
curl -x 127.0.0.1:8080 -v myip.ipip.net
Advanced (without privileged):
docker run --rm --name ipsec-client --env-file=ipsec.env --cap-add=NET_ADMIN --device=/dev/ppp --sysctl=net.ipv4.ip_forward=1 --sysctl=net.ipv4.conf.all.accept_redirects=0 --sysctl=net.ipv4.conf.all.send_redirects=0 --sysctl=net.ipv4.conf.all.rp_filter=0 --sysctl=net.ipv4.conf.default.accept_redirects=0 --sysctl=net.ipv4.conf.default.send_redirects=0 --sysctl=net.ipv4.conf.default.rp_filter=0 --sysctl=net.ipv4.conf.eth0.send_redirects=0 --sysctl=net.ipv4.conf.eth0.rp_filter=0 -v=/lib/modules:/lib/modules:ro -p=8080:8080 chenhw2/ipsec-client
Content type
Image
Digest
Size
96.2 MB
Last updated
about 5 years ago
docker pull chenhw2/ipsec-client