[Solved] Openvpn config for container

It was enough to restart container inside the same subnetwork as another an run inside the vpn container:

iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s -j ACCEPT

ip a:
tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100
inet peer scope global tun0
valid_lft forever preferred_lft forever

It works but I don know if I undestand why ? :slight_smile:
[end solution]

Hi ,
I have a proper config for openvpn runing as a server process ( on debian jessie). It works fine as a normal daemon process on server

When i try to copy this config to the container (debian with installed openvpn)
with exposed port 1194 to the server it does not work.

i used command
docker run -it --name vpn --rm
-p 1194:1194/udp
–cap-add=NET_ADMIN --device=/dev/net/tun
vpn bash

then I try to rm /etc/openvpn
docker cp /etc/openvpn vpn:/etc/openvpn

After that i try to start server inside container vpn:
service openvpn start (daemon openvpn starts correctly)

On the end I cannot connect to the server from client with the same authorization as before.

Any suggestions?
regards, Olaf


FROM debian
RUN apt-get -y update && apt-get -y install openvpn openssl nano iptables procps
RUN apt-get clean && apt-get autoclean && rm -rf /var/lib/apt/lists/*
EXPOSE 1194:1194/udp