I have recently installed an openvpn server on GCP, in a docker container, from https://github.com/kylemanna/docker-openvpn.

The docker-host has packet forwarding enabled.

Now I am struggling with the configuration. I can connect to the server with my openvpn client, but I cannot either route all traffic through the vpn or no traffic at all.

here is my config:

verb 3
key /etc/openvpn/pki/private/mycompany.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/mycompany.net.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60

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

user nobody
group nogroup

### Route Configurations Below

### Push Configurations Below
push "dhcp-option DNS"
push "dhcp-option DNS"
push "route"

I have 2 issues here:

  1. I don't understand what should I put in the local route at the bottom, before the pushes.
  2. "redirect-gateway def1" is added to client.ovpn, but I don't see any config that controls tat behaviour. If I don't remove this from client.ovpn, all traffic is routed through the vpn, but I only need to route and access all other addresses directly through my local gateway.

I need the vpn connection to reach the machines in the same subnet the openvpn server is, and nothing more. I don't need my local network to be accessible from GCP, but I understand I need a route to send the packets back to the client (hence the confusion about that route directive).

My local network has class C private addresses (192.168.x.x) The remote subnet has cidr The vpn clients and server get class B addresses (

  • 1
    I think you need to add vpn_gateway to the end of the route line.route vpn_gateway
    – Paul H.
    Mar 29, 2018 at 15:06

1 Answer 1


In the end the dockerized openvpn has a lot of nice helper scripts, which take care of most config. I found the solution by reading the documentation for those scripts carefully.

  • Would you mind posting the solution here..? Jan 3, 2020 at 7:27

You must log in to answer this question.

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