# docker-compose.yamlversion: '3'services:
vpn:
image: hwdsl2/ipsec-vpn-server
restart: always
env_file:
- ./vpn.env
ports:
- "500:500/udp" - "4500:4500/udp" - "1701:1701" privileged: true hostname: ipsec-vpn-server
container_name: ipsec-vpn-server
# vpn.env# Note: All the variables to this image are optional.# See README for more information.# To use, uncomment and replace with your own values.# Define IPsec PSK, VPN username and password# - DO NOT put "" or '' around values, or add space around =# - DO NOT use these special characters within values: \ " 'VPN_IPSEC_PSK=random_or_online_generate_PSK
VPN_USER=yourself_username
VPN_PASSWORD=yourself_password
# Define additional VPN users# - DO NOT put "" or '' around values, or add space around =# - DO NOT use these special characters within values: \ " '# - Usernames and passwords must be separated by spaces# VPN_ADDL_USERS=additional_username_1 additional_username_2# VPN_ADDL_PASSWORDS=additional_password_1 additional_password_2# Use a DNS name for the VPN server# - The DNS name must be a fully qualified domain name (FQDN)# VPN_DNS_NAME=vpn.example.com# Specify a name for the first IKEv2 client# - Use one word only, no special characters except '-' and '_'# - The default is 'vpnclient' if not specified# VPN_CLIENT_NAME=your_client_name# Use alternative DNS servers# - By default, clients are set to use Google Public DNS# - Example below shows Cloudflare's DNS service# VPN_DNS_SRV1=127.0.0.53# VPN_DNS_SRV2=1.0.0.1
# listen-vpn.service [Unit]Description=Listen vpn NIC and modify mtu
[Service]Type=simple
ExecStart=/usr/bin/listen-vpn
KillMode=process
Restart=on-failure
[Install]WantedBy=multi-user.target