Skip to content
Advertisement

Simulate VPN connection in docker

I want to simulate a VPN traffic on my machine. I’ve set up VPN server which runs inside a docker image. I can successfully log in. The problem is that the docker image is running on my machine on the default docker’s bridge – docker0.

There is no change if I do connect to machine using VPN or not. It is still reachable due to the bridge. I’m wondering machine should be on different (simulated) LAN. Is there some solution how to simulate a VPN connection in docker?

Advertisement

Answer

The client needs to be on a different subnet from that of docker0 otherwise you will always connect directly.

Think about the basics of setting up a VPN tunnel: you run a VPN so that you can connect a two endpoints and make it so that those two endpoints on the same subnet can talk to each other across a public net.

When both your client and your server VPN are running on the same subnet then, well there’s not need to setup a VPN !

Hope it helps.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement