How To Add a DNS Zone in cPanel/WHM
cPanel/WHM is very efficient when it comes to DNS management. You can setup a DNS zone with just a few clicks. When a website is created in WHM, a DNS zone is also created in WHM. Additionally, you can create DNS zones in WHM without adding a website.
This tutorial will briefly walk you through adding a DNS zone in WHM.
Step 1: Logging in to WHM
Being able to manage DNS zones requires access to WHM. Simply go to http://YourHostname:2087
and enter your login information. If this is your first time logging in, you can get started with the One-Click cPanel guide.
Step 2: Adding a DNS zone
On the left-hand navigation menu, find "DNS Functions" and click "Add a DNS Zone".
Under "Domain Information", enter an IP address and a domain name. The IP address entered here will be used for the A records and other default records. In this example, 1.2.3.4
is the IP address, and example.com
is the domain name. Click the blue button labelled "Add Zone" to add the DNS zone.
The zone will now be created. Pay close attention to the output. Upon success, it will read similar to the following:
Results of adding zone example.com
Zone created successfully for IP 1.2.3.4.
Zone is owned by system.
You can now view and edit the DNS zone by clicking "Edit DNS Zone" (from the left-hand navigation menu), choosing a zone, and clicking "Edit". A default zone will look like this:
You can add new entries by entering record information under "Add New Entries Below this Line". Click "Save" to add them.
Step 3: Removing a DNS zone
You can remove a DNS zone by clicking "Delete a DNS Zone" (from the left-hand navigation menu), choosing one or more zones, and clicking "Delete".
Testing zones on your DNS server
The Linux dig
command is a tool for performing DNS lookups. You can test zones that were added to your DNS server by specifying the IP address of your DNS server when performing a lookup.
dig @1.2.3.4 www.example.com
...
;; ANSWER SECTION:
www.example.com. 14400 IN CNAME example.com.
example.com. 14400 IN A 1.2.3.4
...
Using this DNS server on the internet
For a DNS zone hosted on your cPanel/WHM server to become publicly available on the internet, the owner of the domain must set the nameservers of the domain to point at your cPanel/WHM server. The nameservers are set at the registrar (where the domain was purchased). Each registrar has their own interface for managing domains and nameservers.
If you are planning to use this server to host DNS for your own domain name, you will also need to specify glue records at your registrar. Glue records solve the problem of a looping condition during DNS lookups. For example, if you own example.com
, and your cPanel/WHM server is ns1.example.com
, you would need to setup glue records. Again, each registrar has their own interface for managing these records.