I set up a Linux server (VirtualBox VM for now)
In that server I run a Docker container
containing two things:
- An app with web interface on certain port
- Open VPN Client
I can access that app (from my host machine, since Linux is VM guest) and everything works fine until I connect VPN.
VPN works – traffic goes through it but I can't connect to my app anymore (ERR_CONNECTION_TIMED_OUT).
So my goal is to:
- Have a server in Docker container where all the traffic goes through VPN
- Be able to access that server/container in my local network (as I do now when VPN is not connected)
How can I achieve it?
This is how my .ovpn file looks like
client
auth-user-pass
ping 5
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
verb 3
route-metric 1
proto udp
ping-exit 30
cipher AES-256-CBC
// cetrificate here
remote <remote-host-ip>
Best Answer
Have you tried creating a routing inside the docker?
Try adding these via command line:
Where: X.X.X.X is the LAN address of the docker
Y.Y.Y.0 is the network address for the LAN of docker e.g 192.168.1.0/24
ETH0 is your LAN interface
Z.Z.Z.Z is the Lan gateway i.e Your router IP most likely
Note that these commands don't survive a reboot. So if you would like to keep them, put them in /etc/rc.local with a "sleep 30" command.