0

I am looking for a solution with which distributed clients can easily reach each other via the internet.

For this I have set up an OpenVPN server to which all clients connect. If I connect myself to the server, I can reach all devices via IP.

What is a (recommended) network structure to provide name resolution for the connected clients?

Or do you have a better solution with which I can easily reach my distributed devices (call them by name)?

4
  • Your question is unclear. This can't "work out the box" in most unspecified environments as it needs to interface with DNS - which is.not a one size fits all solution.
    – davidgo
    Commented Apr 26, 2022 at 2:33
  • FWIW, you can easily bypass the "gets IP dynamically with OpenVPN.
    – davidgo
    Commented Apr 26, 2022 at 2:34
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Apr 26, 2022 at 2:35
  • thank you for the feedback @davidgo 1. thanks for your reply, that was my expectation/understanding too, I just wanted to be on the safe side, not that I missed something obvious and made another mistake (at)davidgo 2 in this direction, that the clients get their ip from another dhcp-server, I also thought about it. I have set up an environment in Docker with openvpn-server and pihole, unfortunately without success so far. Feedback that this would be a solution in principle would help me a lot. (at)bot thx ;-) done, I do my very best
    – matthias
    Commented Apr 28, 2022 at 14:28

1 Answer 1

0

Using OpenVPN in tun mode (which is the more common mode, and logical choice here) means that OpenVPN assigns a second IP address to each connected device, and clients can reach each other through the openvpn server assigned IP

It is easy enough to ensure that Openvpn assigns a non-changing address to each client. There are multiple mechanisms whereby this can be done including the use of a shared pool of space which openvpn tracks and stores - the ifconfig-pool-persist directive (just ensure the number if clients is less then the pool size and the pool file is backed up) - or create a specific configuration file per client using ifconfig-push statements on the server.

Its worth pointing out that if you are using pki (private key infrastructure) - which makes sense in most environments, the user name/client name is the name specified un the subject name on the cert.

Once you have the static IPs defined you can define them in your DNS. How you do this is dependant on your DNS configuration and can be as simple as hard coding these. Alternatively Openvpn provides a hook "lean-address" which will run a script - with $1 $2 and $3 being yhe name of the action, ip and username-per-subject-cert and can be used to modify your dns as appropriate to your environment.

4
  • thx a lot for your input. this has helped me a lot to read further into openvpn.
    – matthias
    Commented May 2, 2022 at 20:30
  • i tried to configure an dhcp to ovpn -> github.com/mknoepke/ovpn_pihole_docker_dhcp/blob/test_bridge/… but my clients wouldn't get an ip... have you any experiences with dhcp and maybe ovpn in a docker env i hope, that pihole (as dns and dhcp server) this way the task of name resolution takes over.
    – matthias
    Commented May 3, 2022 at 12:42
  • AFAIK (and im generally competent here) you cant use dhcp with OpenVPN in "tun" mode - and tap mode is usually a mistake as its slow and "not vpn like" . The link above uses tap mode. Other then "so you can use dhcp" tap mode why do you want that? That could also be your problem - if you did not configure vpn to use tap. That said, you can use "dhcp-option DNS", or push " dhcp-option DNS" on the server side - to suggest an appropriate server in tun mode I believe. Have a look at kifarunix.com/…...
    – davidgo
    Commented May 3, 2022 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .