I have OpenVPN server with few devices connected in (web server, Raspberry Pi, netbook and phones).

I want to create DNS over VPN (custom .vpn domain).

I have done it with dnsmasq and address directive in config file



I changed few settings in OpenVPN server to set custom DNS server for clients and everything is working but I am afraid that dnsmasq is not the best way to do this.

  • 1
    dnsmasq is a fine way to do this. – dirkt Aug 16 '18 at 11:02
  • @dirkt I afraid about that because I do not really understand what mean that dnsmasq is a "DNS forwarder". – stachu Aug 16 '18 at 21:49

I do not really understand what mean that dnsmasq is a "DNS forwarder".

Look at the man page:

dnsmasq - A lightweight DHCP and caching DNS server.


Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server. It loads the contents of /etc/hosts so that local hostnames which do not appear in the global DNS can be resolved and also answers DNS queries for DHCP configured hosts.

So if you ask dnsmasq about names in your custom *.vpn domain, it will answer directly. If you ask dnsmasq about other names, like superuser.com, it will forward the query to your ISP's DNS server, cache the answer, and send the answer back.

Which is exactly what you want for your purpose.

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.