Here, the more permissive zone-specific access control lists apply to
queries in the name server's authoritative zones, but the more
restrictive global access control list applies to all other queries.
If we were running BIND 8.2.1 or newer, we could simplify this
configuration somewhat using the allow-recursion
substatement:
acl "internal" {
192.249.249/24; 192.253.253/24; 192.253.254/24;
};
acl "slaves" {
192.249.249.1; 192.253.253.1; 192.249.249.9; 192.253.253.9;
};
options {
directory "/var/named";
allow-recursion { "internal"; };
use-id-pool yes;
};
zone "movie.edu" {
type master;
file "db.movie.edu";
allow-transfer { "slaves"; };
};
zone "249.249.192.in-addr.arpa" {
type master;
file "db.192.249.249";
allow-transfer { "slaves"; };
};
We don't need the allow-query
substatements anymore: although the name server may receive queries
from outside our internal network, it'll treat those queries as
nonrecursive, regardless of whether they are or not. Consequently,
external queries won't induce our name server to send any
queries. This configuration also doesn't suffer from a gotcha
the previous setup is susceptible to: if your name server is
authoritative for a parent zone, it may receive queries from remote
name servers resolving domain names in a subdomain of the zone. The
allow-query solution will refuse those
legitimatequeries, but the
allow-recursion solution won't.
Another option is to run two named processes on
a single host. One is configured as a delegated name server, another
as a resolving name server. Since we have no way of telling remote
servers or configuring resolvers to query one of our name servers on
a port other than 53, the default DNS port, we have to run these
servers on different IP addresses.
Of course, if your host already has more than one network interface,
that's no problem. Even if it has only one, the operating
system may support IP address aliases. These allow you to attach more
than one IP address to a single network interface. One
named process can listen on each. Finally, if
the operating system doesn't support IP aliases, you can still
bind one named against the network
interface's IP address and one against the loopback address.
Only the local host will be able to send queries to the instance of
named listening on the loopback address, but
that's fine if the local host's resolver is the only one
you need to serve.
First, here's the named.conf file for the
delegated name server, listening on the network interface's IP
address:
acl "slaves" {
192.249.249.1; 192.253.253.1; 192.249.249.9; 192;253.253.9; };
};
options {
directory "/var/named-delegated";
recursion no;
fetch-glue no;
listen-on { 192.249.249.3; };
pid-file "/var/run/named.delegated.pid";
};
zone "movie.edu" {
type master;
file "db.movie.edu";
allow-transfer { "slaves"; };
};
zone "249.249.192.in-addr.arpa" {
type master;
file "db.192.249.249";
allow-transfer { "slaves"; };
};
zone "." {
type hint;
file "db.cache";
};
Next, here's the named.conf file for the
resolving name server, listening on the loopback address: