Skip to content

WHM DNS cluster — setting up master/slave for redundancy

A WHM DNS cluster keeps zones in sync across multiple nameservers. Here is how to set up a master plus standalone or DNSONLY slaves, and what each step actually does.

A single nameserver is a single point of failure. When that nameserver goes down, every zone it serves vanishes from the internet for the duration. WHM’s DNS clustering replicates zones across two or more nameservers so the loss of one doesn’t take the zones offline. Setting it up requires API tokens, two-way trust, and a clear understanding of which node is authoritative for writes.

What’s happening

WHM clusters DNS by giving each node an API token for the other nodes and a synchronization policy. The two common policies:

  • Standalone: each node holds its own copy and serves the same zones. Changes made on any node can replicate to others if configured bidirectionally, but each node accepts edits.
  • Write-Only (with a DNSONLY peer): the cPanel host pushes changes to peers; peers don’t push back. The cPanel host is the source of truth.

The clustering daemon (dnsadmin) listens on each node and synchronizes zone files (/var/named/*.db) plus zone metadata. When a zone is added or modified on the master, dnsadmin pushes the new content to each peer via the API token. The peers reload named to pick up the change.

Two-way trust is mandatory for both directions of sync. Each node’s WHM has a “DNS Cluster” interface where you add peer hosts, paste their API tokens, and select a role (Standalone, Write-Only, or Sync). Until both ends accept each other, the cluster is half-built and changes don’t propagate.

How to verify

Confirm the cluster status on each node:

whmapi1 dnscluster_listpeers
/scripts/dnscluster status
ls -la /var/cpanel/cluster/root/

Each peer’s status should be “Active” and the role should match what you intended.

Trigger a manual sync and watch the log:

/scripts/dnscluster synczone example.com
tail -100 /usr/local/cpanel/logs/dnsadmin/log

The log shows every push to every peer, with HTTP status codes. A 200 means the peer accepted; anything else (401, 403, 500) points to the peer’s configuration.

Confirm the peer is serving the same zone:

dig @peer.example.com +short SOA example.com
dig @master.example.com +short SOA example.com

The SOA serial should match. If it doesn’t, the sync is broken or one side is editing locally without replicating.

What to do

  1. Generate an API token on each node in WHM > Development > Manage API Tokens. The token needs the “DNS” permissions. Save each token; they’re shown once.
  2. On the master, go to WHM > Clusters > DNS Cluster, add a peer with hostname, API token, and role. For a master/slave with cPanel + DNSONLY slave, set the role to “Write-Only” with the slave as the destination.
  3. On the slave (which can be a full cPanel host or a DNSONLY server), do the reverse: add the master as a peer with the master’s API token. The role on the slave is “Standalone” or “Sync” depending on policy.
  4. Test the cluster with /scripts/dnscluster synczone <some-zone>. The slave should now serve the zone identically to the master.
  5. Add the slave’s hostname and IP to every domain’s NS record set, so the slave is queried alongside the master. The slave is useless if nobody asks it.
  6. Set up a sync check — a cron that compares SOA serials across the cluster and alerts on drift. Without this, a broken sync goes undetected until someone notices the zones don’t match.

For more than two nodes, repeat the trust pair-by-pair. Three nodes need three trust pairs (a-b, b-c, a-c). Don’t skip any — a node that doesn’t trust one peer will get out of sync from that peer’s edits.

Stack Harbor sets up and monitors DNS clusters across hosts as part of cPanel/WHM management.