DNS and NAME BASED APACHE
Chip Old
fold at bcpl.net
Sun Jul 15 13:42:08 UTC 2001
On Sun, 15 Jul 2001, Christopher Meiklejohn wrote:
> If there were going to be a large number of zones.. it might
> be more efficient to use the $INCLUDE directive, because
> if the IP is to ever change, changing 50 zone files woulnd't
> be the best use of your time.
>
> With the $INCLUDE you could include one file with the www A records
> for every domain.
> [snip]
In most web hosting scenarios the zone file is going to be exactly the
same for every hosted domain. In that case rather than create a separate
zone file (or include file) for each zone, it's more efficient to simply
use a single generic zone file for all the hosted domains. Here's an
example, assuming the hosting domain is "hostdomain.com", the generix zone
file is "db.virthosts", and you're doing name-based virtual hosting in
Apache:
;
; /var/named/db.virthosts
;
$TTL 6h ; Default TTL 6 hours
@ IN SOA ns1.hostdomain.com. admin.hostdomain.com. (
2001071500 ; Serial Number
6h ; Refresh after 6 hours
1h ; Retry after 1 hour
20d ; Expire after 20 days
1h ) ; Negative caching TTL 1 hour
;
; Name Servers
;
IN NS ns1.hostdomain.com.
IN NS ns2.hostdomain.com.
;
; Mail Exchangers
;
IN MX 10 smtp1.hostdomain.com.
IN MX 100 smtp2.hostdomain.com.
;
; Hosts
;
www IN CNAME virthosts.hostdomain.com.
Of course the zone files for hostdomain.com and <whatever>.in-addr.arpa
must already contain A and PTR records for ns1, ns2, smtp1, smtp2 and
virthosts.
Then in your named.conf, the "file" directive for each hosted zone points
to that single generic file, like this:
zone "abc.com" {
type master;
file "db.virthosts";
};
zone "xyz.org" {
type master;
file "db.virthosts";
};
In most web hosting scenarios that's all you need. A hosted domain needs
its own zone file only if that domain needs something not present in the
generic zone file.
--
Chip Old (Francis E. Old) E-Mail: fold at bcpl.net
Manager, BCPL Network Services Phone: 410-887-6180
Manager, BCPL.NET Internet Services FAX: 410-887-2091
320 York Road
Towson, MD 21204 USA
More information about the bind-users
mailing list