I have few docker containers on the same machine and one of them is running OpenVPN server, so it has network interface tun0 ( This virtual private network has one client remotely.
I need to be able to communicate with that remote client from another docker containers or from the host machine, as if they would be in the same local network. I added route on the host machine:

# ip route add dev docker0 

Now I can ping (VPN server) but clients are unreachable:

# ping
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable

I tried TAP and TUN OpenVPN device modes, default and subnet topologies - doesn't help


You should have a look at my answer here: https://serverfault.com/a/879809/67419 that's exactly what I have configured execpt that I did not use the default Docker bridge but created a dedicated one. But it would work similarly with the default bridge.

You indeed have to add the proper route (as you did), but you also need at least to allow FORWARDING on your iptables, something like sudo iptables -A FORWARD -i tun+ -j ACCEPT.

Make sure also to have client-to-client and topology subnet at least in your OpenVPN server configuration.

All the details are in my other answer.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.