1

Networking is still black magic for me and i'm trying to route the traffic from my openvpn server in docket to my openvpn client also in docker.

I'm trying to achieve this :

My computer --> VPN --> (docker openvpn server) My server (docker openvpn-client) --> Paid VPN --> World

The openvpn client is connected to my paid vpn, is running with transmission in another container using

network_mode: "container:openvpn-client"

The server is running fine and i can connect my computer to the server when i'm not using the network mode like transmission. If i use it openvpn-server log me this :

openvpn-server    | Sun Dec  2 18:06:23 2018 192.168.0.10:55375 TLS: Initial packet from [AF_INET]MY_COMPUTER_IP:55375, sid=6dcec3eb d8117758
openvpn-server    | Sun Dec  2 18:07:23 2018 192.168.0.10:55375 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
openvpn-server    | Sun Dec  2 18:07:23 2018 192.168.0.10:55375 TLS Error: TLS handshake failed

Here are my docker-compose file

Client :

version: '3'

services:
  openvpn-client:
    image: dperson/openvpn-client
    container_name: openvpn-client
    cap_add:
      - net_admin
    command: -r "172.20.20.0/24" -f ""
    sysctls:
     - net.ipv6.conf.all.disable_ipv6=0
    environment:
      TZ: 'Europe/Paris'
      ROUTE: "172.20.20.0/24"
    read_only: true
    tmpfs:
      - /run
      - /tmp
    restart: unless-stopped
    ports:
      - 9091:9091
    security_opt:
      - label:disable
    stdin_open: true
    tty: true
    volumes:
      - /dev/net:/dev/net:z
      - ./vpn:/vpn
    networks:
      - docker-net-vpn

networks:
  docker-net-vpn:
    external:
      name: docker-net-vpn

Server

version: '3'

services:
  openvpn-server:
    image: "kylemanna/openvpn:latest"
    container_name: openvpn-server
    ports:
      - 1194:1194/udp
    volumes:
      - /data/openvpn-server:/etc/openvpn
    cap_add:
      - NET_ADMIN
    restart: always
    networks:
     - docker-net-vpn

networks:
  docker-net-vpn:
    external:
      name: docker-net-vpn

And the network created like this

docker network create --attachable=true --driver=bridge --subnet=172.20.20.0/24 --gateway=172.20.20.1 docker-net-vpn

The openvpn-server conf file

server 192.168.255.0 255.255.255.0
verb 3
key /etc/openvpn/pki/private/my-vpn.domain.com.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/my-vpn.domain.com.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun

proto udp
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev tun1
status /tmp/openvpn-status.log

user nobody
group nogroup
comp-lzo no

### Push Configurations Below
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "comp-lzo no"

If anynone has achivied what i'm trying to do let me know !

Bonus : If i can use my pihole as dns provider would be sick !

0

You must log in to answer this question.

Browse other questions tagged .