Managing a DNS Cluster from the command line

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: April 17th, 2019

Managing DNS Zones

Synchronize a zone:

You generally want to synchronize a zone if changes were made and you want to push it out to your nameserver cluster. 

This is essentially the same as going into WHM > Synchronize DNS Records:

/scripts/dnscluster

Running this command by itself will give you a list of options for synchronizing, just as you get in WHM:

  • syncall : sync all zones with all cluster servers. This will find the zone with the largest serial and copy it to all nameservers in the cluster
  • syncalllocal : Finds the zone in the cluster with the highest serial number and copies it to the local server only (instead of to all servers in the cluster) – /scripts/dnscluster syncalllocal –full
  • synczone : Syncs one zone to all servers in the cluster, using the zone with the highest serial number throughout the cluster
  • synczonelocal – Syncs one zone locally, using the zone with the highest serial number throughout the cluster

So for instance, if you have a zone for mydomain.com on your hosting server and you want to synchronize it to all the nameservers in your cluster, you'd run:

/scripts/dnscluster synczone domain.com


Edit a DNS Zone:

To edit a zone, open /var/named/domainname.com.db in a text editor and make your changes. Remember to increment the serial number up by one, so that the correct zone it sync'ed to the nameserver cluster. The serial looks like this:

; cPanel 11.24.4-STABLE_36281 ; Zone file for domainnmame.com $TTL 14400 @      86400    IN      SOA     ns.mynameserver.com. me.mynameserver.com. (
        2009082500    ; serial, todays date+todays
        86400        ; refresh, seconds         7200        ; retry, seconds         3600000        ; expire, seconds         86400 )        ; minimum, seconds

Then use /scripts/dnscluster to copy the zone up to your nameserver cluster. (see above examples)


Removing a DNS zone:

/scripts/killdns domainname.com


Adding a DNS zone:

/scripts/adddns –domain domainname.com


You can also use the  –ip and –reseller flags to indicate what IP and nameservers to use. For usage, just run /scripts/adddns and the help will display.