kylemanna / docker-openvpn

🔒 OpenVPN server in a Docker container complete with an EasyRSA PKI CA
https://hub.docker.com/r/kylemanna/openvpn/
MIT License
8.79k stars 2.4k forks source link

Multiple instances for different IPs? #494

Open mxs42 opened 5 years ago

mxs42 commented 5 years ago

Do I understand correctly that in order to provide an ability to choose external IP I have to create and launch two (or more) independent instances? My server has several external IPs and I want to be able to start VPN session with specific external IP.

protree commented 5 years ago

If you use docker-compose you can use something like this if you want to start 2 different instances on 2 different IPs (XXX.XXX.XXX.XXX and YYY.YYY.YYY.YYY). Just use one block if you want to start only one instance on a specific IP:

openvpn-tcp-1: cap_add:

  • NET_ADMIN image: kylemanna/openvpn restart: always volumes:
  • ./dockerfiles/openvpn/conf-tcp:/etc/openvpn
  • ./dockerfiles/openvpn/pki:/etc/openvpn/pki ports:
  • "XXX.XXX.XXX.XXX:1194:1194/tcp"

    openvpn-tcp-2: cap_add:

  • NET_ADMIN image: kylemanna/openvpn restart: always volumes:
  • ./dockerfiles/openvpn/conf-tcp:/etc/openvpn
  • ./dockerfiles/openvpn/pki:/etc/openvpn/pki ports:
  • "YYY.YYY.YYY.YYY:1194:1194/tcp"