Re: Creation of a domain alias
Bradley Giesbrecht <[email protected]> Thu, 14 May 2009 05:56:55 -0700
| Newsgroups | gmane.network.dns.bind9.dlz |
|---|---|
| Message-ID | <[email protected]> |
Use a joining table. I also use a view for convenience.
// dns_group joins dns_zone and dns_data on dns_group_id
CREATE TABLE `dns_group` (
`dns_group_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name_long` varchar(256) DEFAULT NULL,
`name_short` varchar(256) DEFAULT NULL,
`name_abbreviation` varchar(256) DEFAULT NULL,
PRIMARY KEY (`dns_group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
// add multiple zones with same group_id and you get the same dns_data
records
CREATE TABLE `dns_zone` (
`dns_zone_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`dns_group_id` int(11) unsigned DEFAULT NULL,
`dns_zone` varchar(256) DEFAULT NULL,
PRIMARY KEY (`dns_zone_id`),
UNIQUE KEY `uni_dns_zone` (`dns_zone`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE TABLE `dns_data` (
`domain_dns_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`dns_group_id` int(11) unsigned DEFAULT NULL,
`dns_record` char(255) DEFAULT NULL,
`dns_ttl` int(11) NOT NULL DEFAULT '3600',
`dns_type` char(8) DEFAULT NULL,
`dns_mx_priority` int(3) DEFAULT NULL,
`dns_data` varchar(255) DEFAULT NULL,
`dns_resp_person` varchar(255) DEFAULT NULL,
`dns_serial` int(10) DEFAULT NULL,
`dns_refresh` int(11) DEFAULT NULL,
`dns_retry` int(11) DEFAULT NULL,
`dns_expire` int(11) DEFAULT NULL,
`dns_minimum` int(11) DEFAULT NULL,
PRIMARY KEY (`domain_dns_id`),
KEY `key_dns_zone_id_host` (`dns_group_id`,`dns_record`),
KEY `ind_type` (`dns_type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE VIEW `dns_view` AS
select
`
t1
`
.`
dns_zone
`
,`
t2
`
.`
dns_record
`
,`
t2
`
.`
dns_ttl
`
,`
t2
`
.`
dns_type
`
,`
t2
`
.`
dns_mx_priority
`
,`
t2
`
.`
dns_data
`
,`
t2
`
.`
dns_resp_person
`
,`
t2
`
.`
dns_serial
`
,`
t2`.`dns_refresh`,`t2`.`dns_retry`,`t2`.`dns_expire`,`t2`.`dns_minimum`
from (`dns_zone` `t1`, `dns_data` `t2`)
where `t1`.`record_status_id` = 1
and `t2`.`record_status_id` = 1
and `t1`.`dns_group_id` = `t2`.`dns_group_id`
// named.conf
{select dns_zone from dns_view where dns_zone = '%zone%' and
dns_type = 'soa'}
{select dns_ttl, dns_type, dns_mx_priority, case when
lower(dns_type)='txt' then concat('\"', dns_data, '\"')
when lower(dns_type) in ('soa', 'ns') then concat_ws(' ',
dns_data, dns_resp_person, dns_serial, dns_refresh, dns_retry,
dns_expire, dns_minimum)
else dns_data end from dns_view where dns_zone = '%zone%' and
dns_record = '%record%'}
//Brad
On May 13, 2009, at 7:33 PM, Graham Weldon wrote:
> Hey,
>
> I am trying to setup a Domain Alias from one domain to another.
> The ideal result would be that all the records defined on one domain
> will
> end up applying on the alias domain.
>
> Domain-a.com
> - www
> - ftp
> - mail
>
> Domain-b.com (alias of Domain-a.com)
> - www (inherited from alias)
> - ftp (inherited from alias)
> - mail (inherited from alias)
>
> I understand that with traditional zonefile use, you can include the
> zonefile of the main domain in the definition of the zone for the
> alias
> domain:
>
> Zone "domain-a.com" { file "domain-a.zone"; }
> Zone "domain-b.com" { file "domain-a.zone"; }
>
> However, I was wondering if anyone had any tips / pointers for a
> similar
> effect for use with DLZ. I understand this might require adjusting my
> queries, and perhaps data base structure to allow a domain to be
> flagged as
> an alias, perhaps, and querying off an alias domain id?
>
> Any thoughts?
>
> Cheers,
> Graham Weldon
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances!
> Your
> production scanning environment may not be a perfect world - but
> thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW
> KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com_______________________________________________
> Bind-dlz-testers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Bind-dlz-testers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers