if I create a DNS CNAME entry for domain1.tld so it points to domain2.tld (with the trailing dot) and similar www.domain1.tld to point to domain2.tld.
I looked in /etc/nsd/zones/domain1.tld.txt and it contains the cname lines correctly:
www in CNAME domain2.tld
In /home/user-data/dns/custom.yaml it looks correct and the same in the admin interface.
If I howover do dig @myMiabBox www.domain1.tld it gives me
www.domain1.tld. IN A
I tried to restart the nsd service but that did not help. Then I checked the zone file
nsd-checkzone domain1.tld /etc/nsd/zones/domain1.tld.txt
This showed that there was an error on line 19, 20, and 21
Line 19 happend to be the one with
in CNAME domain2.tld
basically the one pointing from domain1.tld to domain2.tld
The error was
error: zones/domain1.tld.txt:19: CNAME and other data at the same name
If I removed that line, then the zonecheck say that everything is ok and after restarting nsd service I can now see (with dig) that CNAME works for www.domain1.tld
I cannot see why this should not work though the DNS RFC says that it is not recommended to do it.
If it breaks the zone files then it would maybe be a good idea to have a check that CNAME entries can only be added for sub-domains?