Introduction
Delegating a subdomain's DNS to another DNS server allows that DNS server to control DNS for that subdomain and any subdomains of it. Without such delegation, DNS for all subdomain levels is controlled by the DNS server for the main domain. For example, if DNS for sub.domain.tld is delegated to another DNS server, that DNS server could add a DNS record for mail.sub.domain.tld.
Subdomain DNS delegation can be useful when you need a cPanel account for a subdomain to control its own DNS. An example of this would be when using DNS based DCV checks in AutoSSL. DNS delegation would allow for a cPanel account for sub.domain.tld to acquire SSLs via DNS based DCV checks even though it does not control the DNS for domain.tld.
Procedure
These instructions will use the following values that will need to be replaced appropriately.
- "sub.domain.tld" - The subdomain to be delegated
- "ns.sub.domain.tld" - The DNS server to delegate DNS to.
- "198.51.100.2" - The IP of the DNS server to delegate DNS to.
1) Ensure that ns.sub.domain.tld resolves to 198.51.100.2. This will need to be done on the server where DNS for domain.tld is hosted. The DNS record will look something like the following.
ns.sub.domain.tld 14400 IN A 198.51.100.2
2) Ensure that all needed DNS records for sub.domain.tld and its subdomains exist at the server with IP 198.51.100.2.
3) Create the NS record for sub.domain.tld on the DNS server controlling DNS for domain.tld. This will look something like the following.
sub.domain.tld. 86400 IN NS ns.sub.domain.tld.
4) Remove the DNS records for sub.domain.tld and any of its subdomains that you want to be delegated to ns.sub.domain.tld. The DNS records added in steps 1 and 3 will need to remain.