Zone Delegation in DNS – How to Delegate Zones

binddelegationdomain-name-system

I'm running a bind 9.8-server and want to delegate a sub-domain to a different dns-server (also administered by me), but I can't seem to get bind to accept my config and I can't figure out why.

Below is my zone-file. I've anonymized it and deleted records of no interest for this topic. Basically I want 192.168.1.12 to handle the tree subdomains prod.mydomain.com, test.mydomain.com and stageing.mydomain.com.

When I run the named-checkzone, this what I get:

named-checkzone mydomain.com. /root/mydomain.com
dns_master_load: /root/mydomain.com:22: test.mydomain.com: CNAME and other data
zone mydomain.com/IN: loading from master file /root/mydomain.com failed: CNAME and other data
zone mydomain.com./IN: not loaded due to errors.

Zonefile:

$ORIGIN mydomain.com.
$TTL 6h
@                       IN  SOA ns01.mydomain.com.  hostmaster.mydomain.com. (
                            2015030502   ; serial number
                            3600         ; refresh
                            3600         ; retry
                            604800       ; expire
                            3600       ) ; minimum TTL

;  Zone NS records
@                           NS  ns01.mydomain.com.
@                           NS  ns02.mydomain.com.

;  Zone records
ns01                        A   192.168.1.10
ns02                        A   192.168.1.11

; SUBDOMAINS
prod.mydomain.com.          NS  ns03.prod.mydomain.com.
ns03.prod.mydomain.com.     A   192.168.1.12

test.mydomain.com.          NS  ns03.test.mydomain.com.
ns03.test.mydomain.com.     A   192.168.1.12

stageing.mydomain.com.      NS  ns03.stageing.mydomain.com.
ns03.stageing.mydomain.com. A   192.168.1.12

Any help is greatly appreciated!

Best Answer

By defining the NS records below the delegation, you have inadvertently combined zone delegation and records within those zones in the same zone file. Try the following simplified config to prevent these warnings:

$ORIGIN mydomain.com.
$TTL 6h
@                       IN  SOA ns01.mydomain.com.  hostmaster.mydomain.com. (
                            2015030502   ; serial number
                            3600         ; refresh
                            3600         ; retry
                            604800       ; expire
                            3600       ) ; minimum TTL

;  Zone NS records
                            NS  ns01.mydomain.com.
                            NS  ns02.mydomain.com.

;  Zone records
ns01                        A   192.168.1.10
ns02                        A   192.168.1.11
ns03                        A   192.168.1.12

; SUBDOMAINS
prod                        NS  ns03.mydomain.com.
test                        NS  ns03.mydomain.com.
stageing                    NS  ns03.mydomain.com.