At one point or another, you may wish to remove a DNS zone from your server configuration. This is not as easy as going through your web server and deleting DNS entries. In the case of cPanel-managed servers, there may be more DNS entries than are immediately obvious at first glance. This is why cPanel (and WHM) provide a few different ways to remove a DNS zone. To run some of the scripts listed in this article requires VPS hosting with cPanel.
Remove a DNS Zone by cPanel Account
The easiest way to remove a DNS zone from cPanel is to remove the cPanel account that created the DNS zone. When a cPanel account is created, a number of DNS entries are created along the way. And additional DNS zones may be created within that account, including addon domains and subdomains. Removing the cPanel account will remove all of the DNS entries created by that account.
This option, as you can imagine, is massively destructive and will wipe out additional domains you may not have intended to remove; so if you only want to remove one DNS zone, you are best advised to use the “Delete a DNS Zone” function (below).
Delete a DNS Zone By Domain
If you do not want (or cannot) delete a DNS entry by deleting the cPanel account associated with it, you can remove the DNS by domain.
- Log into WHM
- Click DNS Functions
- Choose Delete a DNS Zone
Here you are presented with all the domain names that have DNS zones associated with them. Select the domain you want to remove DNS for by checking it and pressing Delete.
If you are noticing any recurrent DNS issues, it’s possible that the problematic DNS zone is not associated with a cPanel account.
For users who are comfortable on the command line, there is also the
killdns script. This script is very powerful, so it must be used with caution. This option will remove any DNS entries associated with the domain you provide. If the domain is associated with an account managed by cPanel, it is recommended that you remove it using one of the methods mentioned above—with the WHM interface, basically. Thus,
killdns is best reserved for situations in which DNS is not managed under an existing cPanel account.
You can run the command by logging into your server via SSH and running the command with the domain:
Check out these other helpful resources from the support center: