cPanel DNS Cluster Setup
I recently wanted to add a secondary DNS Server as part of my cPanel Server and Hosting offering so I wrote a guide about it below.
If you’re looking for High Availability and redundancy then setting up a second Name Server is important. cPanel has this Clustering feature and the second VM or Machine doesn’t need to be a Paid License.
(Free License)
In our setup we have a physical cPanel server and we want to add a Virtual Machine for DNS only.
My originating cPanel server runs on CloudLinux but I will be creating the new DNS server for the cluster in Ubuntu.
Introduction
First of all why do you need 2 name servers in the first place? Why can’t we use the same IP for both NS1 and NS2 ?
If you point example.com to NS1 and NS2 where both of those records point to a single webhosting server and the webserver goes down, then not only will your client not have a website, but no Emails too.
So when we create a redundant cluster for DNS then if the NS1 fails (Main webserver) then NS2 is still providing the DNS to the rest of the world so their emails will still work and the world won’t forget that website belongs to such and such an IP.
It’s to reduce the overall impact of a server going down.
Some registrars do not allow you to enter in the Name Servers which resolve to the same IP address (Makes sense but they got a lot of complains for the single server setup agencies)
Installation of new cPanel ONLY DNS server on Ubuntu 20 LTS :
sudo su –
Make sure DNS is correctly configured by either putting in googles resolvers or ones supplied by your Hoster.
vim /etc/resolv.conf
apt update -y && apt upgrade -y
reboot
SSH back in and
cd /home && curl -o latest-dnsonly -L https://securedownloads.cpanel.net/latest-dnsonly
run the installer
sh latest-dnsonly
Now depending on your server we probably need to wait from 15 to 30 minutes for the installation to complete.
Once installed you will get the message such as
Thank you for installing cPanel & WHM 11.106!
Now go to the front end by typing in (note the port number and https:// ):
Bonus points if you have already setup the DNS for your NS2 to point to the right public IP
Login with your root credentials. If however you cannot then you may need to go back into your ssh terminal, ensure you’re the root user and just reset the root password by doing the following
passwd root
Agree to the Terms
Create an API token on your new Server
Search for “Manage API Tokens” and press “Generate Token”

Enter in the Name , I just typed in “DNS”
Enter in the IP address for the Main cPanel server.
For the permissions just select DNS and Clustering. Everything else can be left unchecked.
Press Save
You will get your token (keep it safe as we need it for the next step)
Setting up the Cluster from the Main cPanel Server
Now It’s time to login to WHM on the Originating server:
https://mainserver:2087 and head over to “DNS Cluster”

Press Enable Cluster
Go Back to the Clusterstatus and press “Configure”

Username is root
API token, paste in the token we got from the previous step.
I have selected “Synchronise Changes ” so that changes made on this main server is propagated to the other DNSOnly server.
After I press submit I get this message:
The cluster is setup.
We need to test to ensure both cPanel servers can resolve a DNS query
In command prompt we can use nslookup (or dig in mac or linux)
Open up CMD
Type in
Nslookup broadband9.com 1.2.3.4
Replace 1.2.3.4 with your main cPanel servers ip.
And do the command again but instead of 1.2.3.4 but this time with the secondary servers IP
(I’ve edited the below picture for ip addresses)
You’ll get a response like this:

As you can see, both servers replied with the right ip.
Just for the purpose of this documentation, we can use dig and query locally as well.
So back into terminal of your new NS2 server and do the following command
dig broadband9.com 127.0.0.1
We are asking the server itself the DNS query and this is the response (highlighted in green to show you the response):

In this guide I originally had NS2 pointing to the same IP as NS1, however when I changed the IP for NS2 in the registrar (just before setting up the cluster) it seems to have had a nice and quick effect in my nameserver record report.
To view this report in cPanel search for “Nameserver Record Report” in the main cPanel server

If it does not seem to reflect here then you can manually change the ip for that nameserver by going to “Basic WebHost Manager setup” and pressing “Configure Address Records” at the bottom of the page.
One last thing, ensure that your hostname on NS2 is actually NS2.domain.tld and not the default one WHM provide. Search for “Change hostname” in the settings.
Our DNS path is currently Main cPanel Server à NS2
Some Notes
For multiple cPanel servers pointing to just two same dns cluster I would have it like this:
Cpanel 1 >> NS1 >> NS2
Cpanel 2 >> NS1 >> NS2
Therefore inside NS1 and NS2 you will have all the collated zones for Cpanel 1 + 2 combined whilst maintaining the fact you only have to worry about setting up NS1 and NS2 for domains regardless of where your clients websites are.
Another more redundant option would be to have cPanel 2 write to NS2 first and setup dns clustering between both NS to sync changes to each other.
This is good for balancing write performance, but in all honesty it can cause issues if you have the same Zone on both cpanel 1 and 2 (for example if you transfer a website over)
Anyway, the purpose of the guide has been fulfilled which was to show you how to setup a 2 node DNS cluster whilst still using the main cPanel as your primary Name Server.