Stranger65536 / docker-ipsec-vpn-client

Docker image for IPsec VPN client used in the host by managing default IP route

Home Page:https://hub.docker.com/r/fengzhou/ipsec-vpn-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker image for IPsec VPN Client

ipsec-vpn-client is a VPN client that can help easy setup IPSec VPN client in Docker and used by the host by managing default IP route.

This image is inspired from configure Linux VPN client using the command line instructions and is tested with IPsec VPN Server on Docker.

By using Docker privileged and host network, the container will update the route to desired subnet once start successfully. The router setting will be restored once stop Docker.

How to use this Docker image

Environment variables

This Docker image uses the following variables, and can be easily managed via env file:

VPN_SERVER_IP=your_vpn_server_public_ip
VPN_IPSEC_PSK=your_ipsec_pre_shared_key
VPN_USER=your_vpn_username
VPN_PASSWORD=your_vpn_password
VPN_SUBNET=CIDR_of_target_subnet
VERBOSE=true|false

Start the IPSec VPN Client

Prepare env file vpn.env (recommended way) or use environment variables directly to create Docker container:

docker run --rm --name vpn-client --env-file=./vpn.env -d --privileged --net=host fengzhou/ipsec-vpn-client

To see more debug information, please set VERBOSE=true in enviornment variable in env file.

Stop the IPSec VPN Client

Use docker stop command can immediately stop VPN client:

docker stop vpn-client

Troubleshooting

Use the following command to check connection logs during container is running:

docker logs vpn-client

Use the following command to check if ppp0 network interface is created or not:

ip a show ppp0

Limitations

  • The docker-ipsec-vpn-server and this vpn client cannot be used together on the same host due to 500/udp, 4500/udp ports conflicts
  • All existing default route will be redirected to VPN server and need manual route rule to split tunnel.

About

Docker image for IPsec VPN client used in the host by managing default IP route

https://hub.docker.com/r/fengzhou/ipsec-vpn-client


Languages

Language:Shell 96.1%Language:Dockerfile 3.9%