How to make a linux CentOS server the master DNS server?

centoscentos8domain-name-systemlinuxnetwork-share

What kind of scripts do I need for that?

Thanks in advance for any explanation or link to tutorial

Best Answer

Here's an example that shows how to set up BIND (aka named, CentOS's DNS server) as a master and a slave for a zone.

This can only be a pointer towards the solution, as you have to answer a few questions to not make your life harder than it has to be:

  • Do you want/need DNSSEC?
  • Do you do static zone management or do you want to use DDNS?
  • Do you want to use TSIG keys to transfer zones to slaves?
  • Do you have more than one slave or plan adding others?

The answers will likely significantly change how you would setup BIND (and your slave(s)).

Here's a (basic) list of steps to follow, assuming no DNSSEC, just the CentOS master and the Windows slave, and IP-based ACLs for transfer:

  • Install bind and ensure that it is started and running on startup.
  • Create a valid zone file and enter your desired zone information. (Use named-checkzone
  • Use named-checkconf to verify the master's config before reloading the server.
  • Create an ACL containing your slave's IP address.
  • Add your zone to the master's and the slave's config. Add the slave's IP to the master's stanza to trigger notifies and add the master's ip to the slave's config to make it able to fully refresh the zone when needed.
  • Verify that your servers operate correctly by querying them with suitable DNS clients (e.g. dig or drill).
  • Verify that synchronization is working by making zone changes and reloading the zone with rndc.
  • Announce the servers as NS records in your zone and to your registrar to get the proper glue records.