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.
- Intermediate
- Linux VPS
- 4 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 RunRacks 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 the Dashboard. 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.
RunRacks does not sell domains. You manage child nameservers at the registrar where you bought example.com.
Understand the moving parts
Three things must agree:
- Child (glue) records at the registrar: tell the domain registry that
ns1.example.comis at203.0.113.10. Without these, nobody can find the nameservers. - A records in the `example.com` zone: the same mapping, served by your own DNS.
- 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.10If 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
- Go to Home » Server Configuration » Basic WebHost Manager Setup.
- In the Nameservers section, enter
ns1.example.comandns2.example.com. - Click Configure Address Records next to each one and enter the IP. WHM adds the A records to the
example.comzone on this server. - 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.
grep -E '^(TCP_IN|UDP_IN)' /etc/csf/csf.confCheck it works
Check the glue records at the registry. Replace the TLD server as needed. For a .com domain:
dig +norec @a.gtld-servers.net example.com NSThe ADDITIONAL section should list ns1.example.com and ns2.example.com with your IP.
Ask your server directly:
dig @203.0.113.10 example.com NS +short
dig @203.0.113.10 ns1.example.com A +shortThen test from the public internet:
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
- Choose the DNS software: configure the nameserver service in WHM.
- Background on glue: glue records and private nameservers.
- Edit individual zones: edit a DNS zone in WHM.
Was this guide helpful?
Still stuck?
Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.
Related guides
Control panels
How to install Plesk on a Linux VPS (AlmaLinux and Ubuntu)
Install Plesk on a fresh Linux VPS with the official one-click installer, apply your licence key and log in to the panel for the first time on port 8443.
- Beginner
- Linux VPS
- 8 min read
Control panels
CyberPanel: back up and restore a website
Create on-demand and scheduled website backups in CyberPanel, download the archives off the server, and restore a site from a backup when something breaks.
- Intermediate
- Linux VPS
- 6 min read
Control panels
Plesk Backup Manager: schedule backups and restore a site
Set up scheduled backups in Plesk Backup Manager, keep a copy off the server, and restore a single domain or subscription when something goes wrong.
- Intermediate
- Linux VPS
- 7 min read