0

I'm setting up OpenVPN inside a Docker container so that clients are able to access other Docker containers on the same user defined bridge network. I've setup OpenVPN using this docker image and I've changed the network from the default bridge to a user defined bridge that uses 10.10.20.0/24.

I've configured OpenVPN to use 10.10.10.0/24 with the following

server 10.10.10.0 255.255.255.0

I've been reading the OpenVPN documentation and have tried the following in the config to expose the Docker network to the OpenVPN client

### Route Configurations Below
route 10.10.20.0 255.255.255.0

### Push Configurations Below 
push "route 10.10.20.0 255.255.255.0"

The following tests are successful:

  • Client is able to connect and get an IP (ex. 10.10.10.5)

  • Ping a Docker container (ex. 10.10.20.3) from a bash shell in the OpenVPN container

  • Ping the OpenVPN container (ex. 10.10.20.2) from a bash shell in a Docker container

The following test fails:

  • Client (ex. 10.10.10.5) ping a Docker container (ex. 10.10.20.3)

This is part of a hobby project I'm starting to learn networking and system administration so I'd like to know what I'm overlooking and what documentation I should be looking at to understand how to resolve this.

2
  • 1
    Do the containers (or their default gateway) have return route for 10.10.10.0/24 (i.e. with 10.10.20.2 as the gateway for that)? Also, is IP forwarding enabled and allowed between the tun (or are you doing tap) and the interface that leads to the other containers?
    – Tom Yan
    Nov 2, 2019 at 2:07
  • Thanks @TomYan read up more on routing and IP forwarding and was able to resolve this.
    – axlshear
    Nov 2, 2019 at 20:34

1 Answer 1

0

I solved this by setting up a forward route in UFW between tun and the bridge device created by docker and adding an ip route between the docker network and the openvpn network

ufw route allow in on tun+ out on br-xxxxxxx
ip route add 10.10.10.0/24 via 10.10.20.2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .