After updating a few DNS records of a domain in BIND 9 (9.16 on Debian 11), I realized a few hours later that the changes were not applied.
By looking closer at the syslog logs, the following error showed up:
Sep 10 14:25:38 bindserver named[3307095]: dns_master_load: /etc/bind/example.com.hosts:28: znuny.example.com: CNAME and other data
Sep 10 14:25:38 bindserver named[3307095]: zone example.com/IN: loading from master file /etc/bind/example.com.hosts failed: CNAME and other data
Sep 10 14:25:38 bindserver named[3307095]: zone example.com/IN: not loaded due to errors.
Whenever there are such errors, a zone file (/etc/bind/example.com.hosts in this case) should be manually verified. For this purpose, there is the command named-checkzone:
root@bindserver:~# named-checkzone example.com /etc/bind/example.com.hosts
dns_master_load: /etc/bind/example.com.hosts:28: znuny.example.com: CNAME and other data
dns_master_load: /etc/bind/example.com.hosts:31: clement.example.com: CNAME and other data
zone example.com/IN: loading from master file /etc/bind/example.com.hosts failed: CNAME and other data
zone example.com/IN: not loaded due to errors.
The same error as seen in syslog before shows up. Two errors were detected in lines 28 and 31, mentioning a problem with "CNAME and other data".
Looking closer at the subdomains of the mentioned CNAME records, there are actually two entries for that subdomain (znuny and clement):
root@bindserver:/etc/bind# grep znuny example.com.hosts
znuny.example.com. IN TXT "v=spf1 +a +a:target.example.com ~all"
znuny IN CNAME target.example.com.
root@bindserver:/etc/bind# grep clement example.com.hosts
clement IN CNAME target.example.com.
clement IN TXT "v=spf1 +a +a:target.example.com ~all"
Another DNS record, a TXT record for SPF, is present at the same time of the CNAME record. The problem? The same subdomain cannot co-exist as CNAME and as another entry. From the CPANEL knowledge base (although I do not use Cpanel myself), there's a helpful information:
This error indicates that you have a domain name in your zone file that owns both a CNAME record and a record of another type.
As I needed to keep the SPF entries for handling outgoing e-mails used for these subdomains, the CNAME was adjusted to an A record pointing to the original target IP address. After this change, the zone file check worked and rndc reload worked, too.
root@bindserver:~# named-checkzone example.com /etc/bind/example.com.hosts
zone example.com/IN: loaded serial 2023091302
OK
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder