Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to a client from the host machine #229

Open
DimaK-tracxpoint opened this issue Mar 7, 2017 · 3 comments
Open

Connecting to a client from the host machine #229

DimaK-tracxpoint opened this issue Mar 7, 2017 · 3 comments

Comments

@DimaK-tracxpoint
Copy link

Hi all and thanks for the great product.
I have to call a service listening on a TCP port - on the OVPN client machine. There is no issue to do so from OVPN server container - but I want to be able to connect from hosting it machine. Is it possible and how the routing has to be set up?
I got the following configuration:

  • Docker host
    • eth0: 10.0.0.199
    • docker0: 172.17.0.1
  • OVPN container
    • eth0: 172.17.0.2
    • tun0-00: 192.168.255.1
  • OVPN client
    • tun0-00: 192.168.255.6

Thanks!

@1070148808
Copy link

sorry,i want to use server ping client,but not success,why????

@jcberthon
Copy link

I'm also trying to solve that issue. I will answer this issue when I've found a solution.

I'm currently trying to configure the host routes to redirect packets to the OVPN container which should do the routing. No success yet, but trying...

The other alternative would be that the tun0 device is not created with the network namespace of the container but in the one of the host (e.g. --net=host) . But I don't like the idea of running the OpenVPN container within the same namespace as the host.

@lukecyca
Copy link

lukecyca commented Aug 5, 2019

  1. Ensure that you have ip forwarding enabled in the docker-openvpn container:
root@vps9:~/server-ops/docker# docker-compose exec openvpn /bin/bash
bash-4.4# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
  1. Configure a new static route in your docker host so that traffic for the vpn network is sent via the docker-openvpn container:
ip route add 192.168.255.0/24 via 172.18.0.11
  1. Ensure your clients get a static route for the docker network so they know to reach it via the VPN server. There are a few ways to do this, but I did it with:
push "route 172.18.0.0 255.255.0.0 192.168.255.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants