Control panels

How to set up private nameservers with cPanel & WHM

Set up private nameservers such as ns1.example.com for your cPanel server. Register child records at the registrar, set them in WHM, add A records and test with dig.

IntermediateLinux server4 min read

Private nameservers let your customers point their domains at ns1.example.com and ns2.example.com instead of a third-party DNS service. cPanel serves the DNS zones itself, so every account you create is live as soon as its domain points at your nameservers. This guide covers the registrar side, the WHM side and how to test that both match.

Before you start

  • cPanel & WHM on a Linux VPS, with the DNS service running (PowerDNS by default).
  • A domain to brand the nameservers with, for example example.com, registered with a registrar that lets you create child nameservers (often called glue records or host records).
  • The server IP from your VPS provider's control panel. This guide uses 203.0.113.10.
  • Optionally, a second IP. Many registrars accept the same IP for both nameservers. Two different IPs, ideally on different servers, give real redundancy.

Note: You manage child nameservers at the registrar where you bought example.com.

Understand the moving parts

Three things must agree:

  1. Child (glue) records at the registrar: tell the domain registry that ns1.example.com is at 203.0.113.10. Without these, nobody can find the nameservers.
  2. A records in the example.com zone: the same mapping, served by your own DNS.
  3. The nameserver list in WHM: what new accounts' zones list as their NS records.

Step 1: Create the child nameservers at the registrar

In the registrar's control panel, find the section for child nameservers, host records or glue records. Create:

ns1.example.com   203.0.113.10
ns2.example.com   203.0.113.10

If you have a second IP, use it for ns2. Save the changes. Registry updates are usually quick but can take a few hours.

Step 2: Set the nameservers in WHM

  1. Go to Home » Server Configuration » Basic WebHost Manager Setup.
  2. In the Nameservers section, enter ns1.example.com and ns2.example.com.
  3. Click Configure Address Records next to each one and enter the IP. WHM adds the A records to the example.com zone on this server.
  4. Click Save Changes.

If example.com is not yet hosted on this server, create an account for it first or add a zone in Home » DNS Functions » Add a DNS Zone, then configure the address records.

Step 3: Point the domain at its own nameservers

At the registrar, set the nameservers for example.com itself to ns1.example.com and ns2.example.com. The domain now uses the nameservers it defines, which the glue records make possible.

Step 4: Make sure DNS is reachable

DNS uses port 53 over both UDP and TCP. If you run CSF, check that 53 is in TCP_IN, UDP_IN, TCP_OUT and UDP_OUT in /etc/csf/csf.conf. The cPanel defaults include it.

Bash
grep -E '^(TCP_IN|UDP_IN)' /etc/csf/csf.conf

Check it works

Check the glue records at the registry. Replace the TLD server as needed. For a .com domain:

Bash
dig +norec @a.gtld-servers.net example.com NS

The ADDITIONAL section should list ns1.example.com and ns2.example.com with your IP.

Ask your server directly:

Bash
dig @203.0.113.10 example.com NS +short
dig @203.0.113.10 ns1.example.com A +short

Then test from the public internet:

Bash
dig example.com NS +short
dig +trace example.com

+trace follows the delegation from the root to your server. It should end with an answer from ns1.example.com or ns2.example.com.

Troubleshooting

  • Registrar refuses the nameserver names: the child records do not exist yet. Create them before setting the domain's nameservers.
  • dig @203.0.113.10 times out: port 53 is blocked or the DNS service is stopped. Check CSF and Home » Server Status » Service Status.
  • Old nameservers still show for existing accounts: the WHM setting only affects new zones. Update the NS records in existing zones.
  • SERVFAIL for some resolvers: the glue IP and the A record do not match. Make them identical.
  • Only one IP for both nameservers: it works, but if the server is down, DNS is too. Consider secondary DNS on another server.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.