subdomain delegation
Kris Nielander <[email protected]> Wed, 11 Mar 2009 11:00:43 +0100
| Newsgroups | gmane.network.dns.bind9.dlz |
|---|---|
| Message-ID | <[email protected]> |
Dear List,
An hot item apparently, I've seen it on the list a couple of times. Now
I need it for reverse delegation.
Several of our customers run their own nameservers and they want to manage
their own reverse ip space, like 0/26. For 1.1.1.in-addr.arpa this would mean
that I would have to create CNAME RRs from 0 to 63 as followed:
0 IN CNAME 0.0-26
1 IN CNAME 1.0-26
2 IN CNAME 2.0-26
...
I also have need for the NS records.
0-26 IN NS ns1.example.net.
0-26 IN NS ns2.example.net.
This works fine. However, all the editing needs to be done in the main
zone which spans multiple customers. So I created a subzone per
customer.
0-26.1.1.1.in-addr.arpa
With two NS records
@ IN NS ns1.example.net.
@ IN NS ns2.example.net.
That doesn't work. However, if I swap the '@' for an '*' it does! Now I've looked
at the query logs and the query using an '*' passes right before the query using
an '@'. Surely, that can't be right or is that just spec?!
{select name from dns_zone where name = '%zone%'}
{select ttl, type, case when type='TXT' then concat('\"', data,
'\"') else data end as data from dns_record where zone_id = '%zone%' and
host = '%record%'}
{}
{select ttl, type, host, data from dns_record where zone_id = '%
zone%'}
{select zone_id from dns_xfr where zone_id = '%zone%' and client
= '%client%'}"
If you consider the example where I used the main zone. The NS records
would be returned right away.
Main zone queries (I'll skip the CNAME resolve process):
select name from dns_zone where name = '1.0-26.1.1.1.in-addr.arpa';
select name from dns_zone where name = '0-26.1.1.1.in-addr.arpa';
select name from dns_zone where name = '1.1.1.in-addr.arpa';
select ttl, type, case when type='TXT' then concat('\"', data, '\"')
else data end as data from dns_record where zone_id =
'1.1.1.in-addr.arpa' and host = '0-26';
Subzone queries:
select name from dns_zone where name = '1.0-26.1.1.1.in-addr.arpa';
select name from dns_zone where name = '0-26.1.1.1.in-addr.arpa';
select ttl, type, case when type='TXT' then concat('\"', data, '\"')
else data end as data from dns_record where zone_id =
'0-26.1.1.1.in-addr.arpa' and host = '1';
select ttl, type, case when type='TXT' then concat('\"', data, '\"')
else data end as data from dns_record where zone_id =
'0-26.1.1.1.in-addr.arpa' and host = '*';
elect ttl, type, case when type='TXT' then concat('\"', data, '\"') else
data end as data from dns_record where zone_id =
'0-26.1.1.1.in-addr.arpa' and host = '@';
table layout
mysql> describe dns_zone;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| name | varchar(64) | NO | PRI | NULL | |
| master | varchar(255) | YES | | NULL | |
| user_id | int(11) | YES | MUL | NULL | |
| created | datetime | NO | | NULL | |
| updated | datetime | NO | | NULL | |
+---------+--------------+------+-----+---------+-------+
mysql> describe dns_record;
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| host | varchar(64) | NO | MUL | NULL | |
| zone_id | varchar(64) | NO | MUL | NULL | |
| ttl | int(11) | NO | | NULL | |
| type | varchar(20) | NO | | NULL | |
| data | varchar(128) | NO | | NULL | |
| created | datetime | NO | | NULL | |
| updated | datetime | NO | | NULL | |
+---------+--------------+------+-----+---------+----------------+
Best regards,
--
Kris Nielander
Network Engineer
We Dare BV
tel: +31.10.7507007
fax: +31.10.7507005
http://www.we-dare.net
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com