![]() | ![]() |
In BIND 8 and 9, the config file statement is:
options {
transfers-per-ns 2;
};
The equivalent BIND 4 boot file directive is:In BIND 9, you can also set the limit on a server-by-server basis instead of globally. To do this, use the transfers substatement inside a server statement, where the server is the name server you'd like to specify the limit for:limit transfers-per-ns 2
server 192.168.1.2 {
transfers 2;
};
This overrides any global limit set in the options
statement. The default limit is two active zone transfers
per name server. That limit may seem small, but it works.
Here's what happens: suppose your name server needs to load
four zones from a remote name server. Your name server starts
transferring the first two zones and wait to transfer the third and
fourth zones. After one of the first two zone transfers completes,
the name server begins transferring the third zone. After another
transfer completes, the name server starts transferring the fourth
zone. The net result is the same as before there were
limits -- all the zones are transferred -- but the work is
spread out.When might you need to increase this limit? You might notice that it is taking too long to synch up with the remote name server, and you know that the reason is the serializing of transfers -- not just that the network between the hosts is slow. This probably matters only if you're maintaining hundreds or thousands of zones. You also need to make sure that the remote name server and the networks in between can handle the additional workload of more simultaneous zone transfers.
The BIND 8 and 9 named.conf file statement is:
options {
transfers-in 10;
};
The equivalent BIND 4 boot file directive is:If your host or network cannot handle 10 active zone transfers, you should decrease this number. If you run a server that supports hundreds or thousands of zones and your host and network can support the load, you might want to raise this limit. If you raise this limit, you may also need to raise the limit for the number of transfers per name server. (For example, if your name server loads from only four remote name servers and your name server will start only two transfers per remote name server, then your server will have at most eight active zone transfers. Increasing the limit for the total number of zone transfers won't have any effect unless you also increase the per-name server limit.)limit transfers-in 10
options {
transfers-out 10;
};
The default limit is 10.
options {
max-transfer-time-in 180;
};
You can even place a limit on transfers of a particular zone by using
the max-transfer-time-in
substatement inside a
zone statement. For example, if you know that
the rinkydink.com zone always takes a long time
(say three hours) to transfer, either because of its size or because
the links to the master name server are so slow, but you'd
still like a shorter time limit (maybe an hour) on other zone
transfers, you could use:
options {
max-transfer-time-in 60;
};
zone "rinkydink.com" {
type slave;
file "bak.rinkydink.com";
masters { 192.168.1.2; };
max-transfer-time-in 180;
};
In BIND 9, there's also a
max-transfer-time-out substatement that can be used the
same way (either within an options statement or
a zone statement). It controls how long an
outbound zone transfer (i.e., a transfer to a slave) can run and has
the same default value (120 minutes) as
max-transfer-time-in.BIND 9 name servers even let you limit zone transfer idle time, the length of time since the zone transfer made any progress. The two configuration substatements, max-transfer-idle-in and max-transfer-idle-out, control how long an inbound and an outbound zone transfer can be idle, respectively. Like the transfer time limits, both can be used as either an options substatement or a zone substatement. The default limit on idle time is 60 minutes.
BIND Versions 9.1.0 and later let you limit the refresh interval with max-refresh-time and min-refresh-time. These substatements bracket the refresh value for all master, slave, and stub zones if used as an options substatement, or just for a particular zone if used as a zone substatement. Both take a number of seconds as an argument:
options {
max-refresh-time 86400; // refresh should never be more than a day
min-refresh-time 1800; // or less than 30 minutes
};
BIND 9.1.0 and later name servers also let you limit the retry
interval with the max-retry-time
and
min-retry-time substatements, which use the same
syntax.
BIND 8 and 9 name servers understand a new zone transfer format, called many-answers. The many-answers format puts as many records as possible into a single DNS message. The result is that a many-answers zone transfer takes less bandwidth because there's less overhead, and less CPU time because less time is spent unmarshaling DNS messages.
The transfer-format substatement controls which zone transfer format the name server uses for zones for which it is a master. That is, it determines the format of the zones that your name server transfers to its slaves. transfer-format is both an options substatement and a server substatement; as an options substatement, transfer-format controls the name server's global zone transfer format. BIND 8's default is to use the old one-answer zone transfer format for interoperability with BIND 4 name servers. BIND 9's default is to use the many-answers format. The statement:
options {
transfer-format many-answers;
};
changes the name server's settings to use the
many-answers format for zone transfers to all
slave servers, unless a server statement like
the following explicitly says otherwise:
server 192.168.1.2 {
transfer-format one-answer;
};
The one downside to using the many-answers
format is that zone transfers can actually take longer to
complete using the new format, despite being more efficient from a
bandwidth and CPU utilization point of view.If you'd like to take advantage of the new, more efficient zone transfers, do one of the following:
For BIND 8 and 9, the statement is:
options {
datasize size
};
For BIND 4, the directive is:size is an integer value, specified in bytes by default. You can specify a unit other than bytes by appending a character: k (kilobyte), m (megabyte), or g (gigabyte). For example, "64m" is 64 megabytes.limit datasize size
TIP: Not all systems support increasing the data segment size for individual processes. If your system doesn't, the name server will issue a syslog message at level LOG_WARNING to tell you that this feature is not implemented.
options {
stacksize size;
};
where size is specified as in
datasize. Like datasize,
this feature works only on systems that permit a process to modify
the stack size limit.
options {
coresize size;
};
Again, as with datasize, this feature works only
on operating systems that let processes modify the limit on core file
size, and doesn't work on versions of BIND 9 before 9.1.0.
[79]Chapter 14, "Troubleshooting DNS and BIND", describes better solutions to the "Too many open files" problem than bumping up the limit on files.
If your operating system also permits changing that limit on a per-process basis, you can increase it using BIND's files substatement:named[pid]: socket(SOCK_RAW): Too many open files
options {
files number;
};
The default is unlimited (which is also a valid
value), although this just means that the name server doesn't
place a limit on the number of concurrently open files; the operating
system may, however. And though we know you're sick of our
saying it, BIND 9 doesn't support this until 9.1.0.
options {
recursive-clients 10;
};
The default limit is 1000. If you find your name server refusing
recursive queries and logging, as shown by an error message like this
one:
you may want to increase the limit. Conversely, if you find your name server struggling to keep up with the deluge of recursive queries it receives, you could lower the limit.Sep 22 02:26:11 terminator named[13979]: client 192.249.249.151#1677: no more recursive clients: quota reached
You can also apply a limit to the number of concurrent TCP connections your name server will process (for zone transfers and TCP-based queries) with the tcp-clients substatement. TCP connections consume considerably more resources than UDP because the host needs to track the state of the TCP connection. The default limit is 100.
options {
serial-queries 1000;
};
serial-queries is obsolete in BIND 9. BIND 9
limits the rate at which serial queries are sent (to 20 per second),
not the number of outstanding queries.
BIND 8 and 9 actively walk through the cache and remove stale records once per cleaning interval. This means that BIND 8 and 9 name servers tend to use less memory for caching than a BIND 4 server in the same role. On the other hand, the cleaning process takes CPU time, and on very slow or very busy name servers, you may not want it running every hour.
By default, the cleaning interval is 60 minutes. You can tune the interval with the cleaning-interval substatement to the options statement. For example:
options {
cleaning-interval 120;
};
sets the cleaning interval to 120 minutes. To turn off cache cleaning
entirely, set the cleaning interval to zero.
options {
interface-interval 0;
};
On the other hand, if your host brings up or tears down network
interfaces more often than every hour, you may want to reduce the
interval.
The syntax of the statistics-interval substatement is exactly analogous to the other maintenance intervals:
options {
statistics-interval 60;
};
And as with the other maintenance intervals, the default is 60
minutes and a setting of zero disables the periodic dumping of
statistics. Because BIND 9 doesn't write statistics to
syslog, it doesn't have a configurable
statistics interval either.
In BIND 8.2 or later name servers, you can limit the TTL on cached negative information with the max-ncache-ttl options substatement. This was designed as a safety net for people who upgraded to 8.2 and its new negative caching scheme (RFC 2308 and all that, described in Chapter 4, "Setting Up BIND"). This new name server caches negative information according to the last field of the zone's SOA record, and many zone admins still use that field for the default TTL for the zone -- probably much too long for negative information. So a prudent name server administrator can use a substatement like:
options {
max-ncache-ttl 3600; // 3600 seconds is one hour
};
to trim larger negative caching TTLs to one hour. The default is
10800 seconds (three hours). Without this precaution, it's
possible that someone looking up a brand-new record could get a
negative answer (maybe because the new record hadn't yet
reached the zone's slaves), and her name server would cache
that answer for an inordinately long time, rendering the record
unresolvable.BIND 9 name servers also let you configure the upper limit of the TTL on cached records with the max-cache-ttl substatement. The default is one week. BIND 8 name servers trim TTLs to one week, too, but they don't let you configure the limit.
Finally, there's what's referred to as the lame TTL , which isn't really a TTL at all. Instead, it's the amount of time your name server remembers that a given remote name server isn't authoritative for a zone that's delegated to it. This prevents your name server from wasting valuable time and resources asking that name server for information about a domain name it knows nothing about. BIND 8 name servers after 8.2 and BIND 9 name servers newer than 9.1.0 let you tune the lame TTL with the lame-ttl options substatement. The default lame TTL is 600 seconds (10 minutes), with a maximum of 30 minutes. You can even turn off the caching of lame name servers with a value of zero, though that strikes us as a Very Bad Thing.