The first step will be to create the nameservers. In order to do that, you must go to the “Basic cPanel and WHM setup” section of your cPanel instance. At the bottom of the page will be a couple of textboxes labeled as name servers. In these boxes, you’ll write the nameservers that you registered with at the registrar.

Now we should verify the name server registration. That will require clicking on the “Nameserver IP” option in the WHM menu on the left-hand side of the page. Note here whether both of the name servers are showing up without an IP address.

If they are, then it’s now time to log in using SSH and delete the cPanel name servers IP cache. Connect to your server and make sure that you have root access. Enter the command below in order to delete the name server ip cache file:

rm /var/cpanel/nameserverips.cache

Edit cPanel Nameservers script file

Your next step is to edit the name servers script file. We’ll do this with nano, or you can use your preferred text editor:

nano /var/cpanel/nameserverips.yaml

For each name server in the file, manually replace the IP addresses with the ones you registered at the registar level for your name servers. See below for an example (using and random IPs for the purpose of this guide): 1
count: '2'
zones:, 1
count: '2'

Note: Replace with the IP address of your first nameserver and with the IP address of your second nameserver.

Save and close the file. The next file we’ll edit is /etc/nameserverips:

nano /etc/nameserverips

The below is an example of how we’d like you to alter the file. Make sure to replace the domain and the IP addresses with your own domain and IP addresses.

Finally, it’s time to restart cPanel and named, which is our name server daemon. Use this command to do so:

/etc/init.d/named restart && /etc/init.d/cpanel restart or service named restart

After having finished, if there are any zones configured to the server, you’ll have to verify that the DNS entries for each name server in each zone match the IP. Go back to your graphical cPanel/WHM interface and click on “Edit DNS Zones” in the left-hand menu. Select each zone and click the “modify” option, which will show you the values. If any of them are incorrect, you can update them and save your changes.

Originally posted on December 15, 2017 @ 12:54 pm

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.