I have OpenVPN server on VPS server and few connected clients (notebooks, print/file server at home etc.).

I would like to connect from client to client or from client to server by using names (instead of IP) like:




What should I do to get such effect without adding ip/host entries in %windir%\system32\drivers\etc\hosts or /etc/hosts on each machine?


You need to run some kind of DNS server of proxy.

An ideal location would be the VPS server itself. dnsmasq has a small footprint and will act as DNS proxy: It will pick up /etc/hosts entries from the machine it is running on and add them to the upstream DNS information. So this will be the single location you have to edit for new entries.

All your clients will need to point to this DNS server. You can configure the OpenVPN server to provide this information when the OpenVPN clients connect.

  • Thanks. One more question: if I "push" DNS configuration to clients - will they use my proxy DNS instead of their own DNS for network traffic, right? I'm thinking about situation, when I have Windows Server with DNS at the office and it provides names of computers present in the office - name resolving for office LAN will stop working. Right?
    – Kamil
    Jul 4 '19 at 14:36
  • 1
    Yes, this situation will be more difficult. You'll have to somehow configure the DNS proxy to use the Windows DNS Server as upstream DNS server. Which means wherever the DNS proxy runs, it always needs a connection to the Windows DNS Server.
    – dirkt
    Jul 4 '19 at 15:20

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.