Using the nameservers on your server can make things a bit easier when it comes to editing your DNS settings. When using the name servers built into cPanel, you can add sub-domains without having to make any changes to the zone file. You can also setup SPF and domain keys with a couple clicks. This setup is ideal for small servers only hosting a few sites. If you are hosting a large number of sites it may be in your best interest to set up a separate nameserver server to ensure the single nameserver won’t be overloaded, thus taking your sites down. They do offer DNS clustering that works great for as many servers as you like. This is the best bet as you would have 4 -10 name servers for each domain.

 

Setting up your name servers is fairly simple if you set up the name servers right off the bat.  Setting them up after the fact isn’t an issue if you plan to use what is set by default. If you want to change them from the default, you may have to edit the zone files for the domains that already exist on the server. To use the name servers for a current domain, you would need to adjust the NS records and the authoritative name server record at the top of the zone file.

You need:

  • WHM Access
  • 2 IP addresses recommended (can use the main IP for both but not suggested.)
  • A domain name to use for the name server names (default is ns1/ns2.hostname.tld)
  • Access to the registrar for name server domain.

To set up your name server you need to log into WHM:

  1. The very first link on the left is “Basic cPanel & WHM Setup”
  2. Once you are in there go all the way to the bottom, for the name server setup area.

If you plan on using the defaults they should already be in place. Now you need to add an IP address to each name server. If you plan on using 1 IP address you will need to go into “Tweak Settings” and search for nameserver. You will need to allow the name servers to share the same IP.

  1. Click add IP next to each name server
  2. When the dialog box pops up make sure you hit add IP for each one.
  3. Remember the IPs as you will need them soon
  4. After you add the IPs MAKE SURE YOU SAVE at the bottom of the page.

You will now need to add A records for each name server. If you will be hosting the DNS for the name servers domain then you can do it here with the “add an A record” button. If not you will need to add the A records to your zone file for the domain. This part can cause issues. Sometimes it will create separate zone files for each name server. This should work as long as the main domain does not also have a zone file. If the main zone file exists for the domain the name server will look in there first, then not find anything as the records are not there.

You can check this by going to “Edit DNS zone” and checking to see if the nameservers are listed in the list. If that happens to you it’s not that big of a deal. All you have to do it edit the main Zone file for the domain and add the A records there. Once you have added the A records you can remove the extra Zone file for each name server, to avoid confusion

Now that you have the IP addresses of the name servers, you need to tell the registrar where they are. You will need to log into your registrar for the domain, then register the name server with their IPs. Once this is done you will now be able to use the name servers as the registrar will point them in the correct direction.

When changing over to the new name servers for an existing domain, just make sure that their NS records match in the zone file. This can cause loops and confusion if they are not correct. Any domain that you add after this will use the name servers that you have specified in the basic setup.

To check your work you can go to nameserver IPs in WHM. If the name servers and the IPs are listed you should be all set. New zones will be created when you set up a new domain automagically.

Trouble Shooting

1. Nothing shows up in nameserver IPs.

You may have forgotten to save in the basic settings, after adding the IPs.
You must have at least one zone using the name servers to show up there
You name servers don’t have A records

2. The name server show but the IPs don’t

You name servers don’t have A records
You may have forgotten to save in the basic settings, after adding the IPs

3. How do I know the name servers are working?

In a terminal, you can run the command “dig domain.com @ns1.hostname.tld”. If this return the correct IP then you should be all set.
You can Browse to the site in a browser.

4. What file is the name server IP information in?

/etc/nameserverips
You need to run /scripts/updatenameserverips after altering the file for the changes to be seen
Proper syntax is: 000.123.456.789=ns1.domain.tld

5. Where is the configuration for the name server?

/etc/named.conf
It is a good idea to disable or limit DNS recursion as this can cause security issues if your nameservers are attacked

 

If your still having issues feel free to open a chat and we would be happy to help!