The DNS zone file is invalid. Line X: ignoring out-of-zone data

The DNS zone file is invalid. Line X: ignoring out-of-zone data

When adding a new DNS records in cPanel > Zone Editor there is an error:

image 21 - The DNS zone file is invalid. Line X: ignoring out-of-zone data

Error: The DNS zone file is invalid. (Line 20: ignoring out-of-zone data (ns1.solutions.rs); Line 21: ignoring out-of-zone data (ns2.solutions.rs))


How to fix error

Check if the DNS zone is valid by running:

named-checkzone domain.com /var/named/domain.com.db

Output will show you which lines are causing the problem:

image 19 - The DNS zone file is invalid. Line X: ignoring out-of-zone data

so now just edit the file and comment the lines (in my case 20 and 21) by adding a semi-colon at the beginning ( ; )

nano /var/named/domain.com.db

turn on line number display in nano with alt shift C

then navigate to the lines (in my case 20 and 21) and comment them:

image 20 - The DNS zone file is invalid. Line X: ignoring out-of-zone data

exit with ctrl x then save with y

Now go back to cpanel and add/edit records that you wish.


Why did this happen?

The DNS zone can be corrupted for a variety of reasons; in my instance, the default zone templates were causing issues because my nameservers were on the same server and the template required that every new domain have the following records:

image 22 - The DNS zone file is invalid. Line X: ignoring out-of-zone data

So I won’t have this problem with new domains if I just remove these records from the template.

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.