Dnsmasq as local dns server

dnsmasqdomain-name-system

I have the following setup:

box one:

  • RHEL 7.3
  • NetworkManager pointing dns to /etc/resolv.conf
  • /etc/resolv.conf pointing at the external IP of itself
  • dnsmasq (configured by someone else) listening on that IP for dns requests
  • dnsmasq having a /etc/dnsmasq.d/something file that points to two external, corp dns servers

box two: being an exact copy of box one, besides pointing to its own IP instead of box one's.

Now I want to host my own TLD "master" on box one in a way that a program on box two is able to create a veth network and assign hostname "vhost1.master", "vhost2.master", "vhost3.master", in such a way that preferably even a box three could be setup with box one as nameserver and be able to reach a webserver at "vhost1.master".

It seems from what I've read that I should just be able to achieve that by adding to box.one:/etc/resolv.conf an entry " master" and everything should work. But it doesn't. What am I missing?

Sorry really new to all this dns self configuration. Some keywords for googling would probably already be enough help for now.

Best Answer

configuration

As a starting point it's always good to read some basics about what DNS actually is.

Next there is a tutorial using dnsmasq for a local domain and as dhcp server.

Further details can be found in the archwiki article about dnsmasq. Noteworthy mention goes to MaraDNS because their docs are in my eyes also helpful to understand the different types of DNS servers (e.g. authorative vs recursive) as well as the importance of zone files.

However MaraDNS doesn't use standardized zone files, therefore the wiki article about zone files shouldn't be forgotten as well.

Finally @BillThor was so nice to provide a link to dnsmasq's man page, which from my investigation seems to be the easiest solution for local needs at least.


debugging

A major tool to debug and analyse dns requests is dig. My colleague however prefers host <target> <nameserver-to-ask>.

Also I found it quite helpful to set the -q flag for the dnsmasq service in the dnsmasq.service file mentioned when you call systemctl status dnsmasq (for me it's /usr/lib/systemd/system/dnsmasq.service). By that one can see who made requests for what.