This HOWTO configures BIND to fully delegate the responsibility for a sub-domain to another name server. This is not the only possible method of defining sub-domains (virtual - or pseudo - subdomains). The following defines the hierarchy we want to create:
To ease the administration load we want to fully delegate the responsibility for the administration of the us sub-domain (and its reverse-lookup) to the the us.example.com management group.
This HOWTO assumes that the name servers for our zone (example.com) are all in our domain. If they are not, the actual configuration is exactly the same but you will have to convince the name server administrator to carry out the configuration. If we own the name servers we can do what we like!
Finally it is important to remember that as far as the internet registration authorities and root name-servers are concerned sub-domains do not exist. All queries for anything which ends with example.com will be directed to the name-servers for the example.com zone. These name servers are responsible for redirecting the query to the sub-domain name-servers.
For want of any better terminology we call our servers the domain name-server (this one is visible to registration authorities) and the the sub-domain name-server (essentially visible only to the domain name-server).
We received some mail which suggested that we show the explicit use of the allow-transfer statement. The samples in Chapter 6 all show this statement in use but for anyone just using this section it is not apparent.
The name servers for our domain are running BIND and has a named.conf file that defines the zone.
The 'named.conf' file will contain statements similar to the following fragment defining the main zone:
// named.conf file fragment
....
options {
....
allow-transfer {"none";};
....
};
zone "example.com" in{
type master;
file "master/master.example.com";
// explicitly allow slave
allow-transfer {192.168.0.4;};
};
// optional - we act as the slave (secondary) for the delegated domain
zone "us.example.com" IN {
type slave;
file "slave/slave.us.example.com";
masters {10.10.0.24;};
};
The optional definition of a slave (secondary) name server for our delegated us.example.com sub-domain is probably good practice but not essential - you can define it to be any name server.
The file 'master.example.com' (or whatever naming convention you use) will contain our domain configuration with two name servers.
; zone fragment for example.com
; name servers in the same zone
$TTL 2d ; default TTL is 2 days
$ORIGIN example.com.
@ IN SOA ns1.example.com. hostmaster.example.com. (
2003080800 ; serial number
2h ; refresh = 2 hours
15M ; update retry = 15 minutes
3W12h ; expiry = 3 weeks + 12 hours
2h20M ; minimum = 2 hours + 20 minutes
)
; main domain name servers
IN NS ns1.example.com.
IN NS ns2.example.com.
; main domain mail servers
IN MX mail.example.com.
; A records for name servers above
ns1 IN A 192.168.0.3
ns2 IN A 192.168.0.4
; A record for mail server above
mail IN A 192.168.0.5
....
; sub-domain definitions
$ORIGIN us.example.com.
; we define two name servers for the sub-domain
@ IN NS ns3.us.example.com.
; the record above could have been written without the $ORIGIN as
; us.example.com. IN NS ns3.us.example.com.
; OR as simply
; IN NS ns3
; the next name server points to ns1 above
IN NS ns1.example.com.
; sub-domain address records for name server only - glue record
ns3 IN A 10.10.0.24 ; 'glue' record
; the record above could have been written as
; ns3.us.example.com. A 10.10.0.24 if it's less confusing
Notes:
Note: All name server queries require both a name and an IP address (a glue record) in the response (answer). In the case of the gTLD or ccTLD servers they provide the glue (IP address) record. These glue records were captured when the domain was registered. The A record for the name server ns2.example.com is not strictly speaking a glue record but the A record for ns1.example.com IS a glue record for us.example.com but NOT, strictly speaking, for example.com.
Assuming our sub-domain name-server is also running BIND we will have the following configuration.
The 'named.conf' file will contain statements similar to the following fragment defining the sub-domain zone:
// named.conf file fragment
....
options {
....
allow-transfer {"none";};
....
};
zone "us.example.com" in{
type master;
file "master/master.us.example.com";
// explicitly allow slave
allow-transfer {192.168.0.3;};
};
The file master.us.example.com (or whatever convention you use) will contain our sub-domain configuration with, say, a couple of name servers.
; zone fragment for sub-domain us.example.com
; name servers in the same zone
$TTL 2d ; default TTL = 2 days
$ORIGIN us.example.com.
@ IN SOA ns3.us.example.com. hostmaster.us.example.com. (
2003080800 ; serial number
2h ; refresh = 2 hours
15M ; update retry = 15 minutes
3W12h ; expiry = 3 weeks + 12 hours
2h20M ; minimum = 2 hours + 20 minutes
)
; sub-domain name servers
IN NS ns3.us.example.com.
IN NS ns1.example.com. ; see notes below
; sub-domain mail server
IN MX 10 mail.us.example.com.
; above record could have been written as
; IN MX 10 mail
; A records for name servers above
ns3 IN A 10.10.0.24
ns1.example.com. IN A 192.168.0.3 ; 'glue' record
; A record for mail server above
mail IN A 10.10.0.25
; next record defines our ftp server
ftp IN A 10.10.0.28
; the record above could have been written as
; ftp.us.example.com. A 10.10.0.28 if it's less confusing
....
; other sub-domain records
....
Notes:
tech info
guides home
dns articles
intro
contents
1 objectives
big picture
2 concepts
3 reverse map
4 dns types
quickstart
5 install bind
6 samples
reference
7 named.conf
8 dns records
operations
9 howtos
10 tools
11 trouble
programming
12 bind api's
security
13 dns security
bits & bytes
15 messages
resources
notes & tips
registration FAQ
dns resources
dns rfc's
change log