In this section we provide some suggested configurations along with guidelines for their use. We also address the topic of reasonable option setting.
logging { channel
named_log{ file
"
logs/named.log"
; print-time
yes; print-category
yes; print-severity
yes; severity info; };
channel
security_log { file
"
logs/security.log"
versions
7; print-time
yes; }; category
default{ named_log; default_debug; }; category
security{ security_log }; }; // The two corporate subnets. // Use real IP numbers // here in the real world. acl
corpnet{ 192.168.4.0/24; 192.168.7.0/24; }; // The options statement. options { directory "
/etc/namedb"; // Directory pid-file "
named.pid"; // Put .pid file in named directory. check-names master
fail; // Fail on db errors in master zones. check-names slave
warn; // Warn about db errors // in slave zones. check-names response
warn; // Warn about invalid responses use-id-pool
yes; // Help prevent spoofing host-statistics
yes; // Keep track of hosts/servers // we've talked to. listen-on { 192.168.7.20; }; // Listen on this address. query-source address 192.168.7.20 port 53 ; // Source queries from port 53 // to get past firewall. allow-transfer { none
; }; // Don't allow anyone to // transfer zones. allow-query { corpnet; }; // Allow only corpnets to query server. // Helps prevent DoS, spoofing. allow-recursion { corpnet; }; // Same, except this is for recursion. };
include "
keys.conf"; // Include a keys.conf with // TSIG/DNSSEC keys. // Shouldn't be readable to anyone // except BIND user. zone "."{ type
hint; file "
local/named.root"; }; // root hints
zone "0.0.127.IN-ADDR.ARPA" {
type
master; file "
local/localhost.db"; notify
no; // localhost };
zone "
example.com" { // Example zone for "example.com". type
master; // It's a master zone. file "
m/example.com.db"; // The file is here. allow-query {
any; }; // Allow anyone to query. allow-transfer { corpnet; }; // Only allow corp nets to transfer zone. };
zone "
offsite.example.com" { // Example zone for an off-site corp zone. type
slave; // It's a slave zone. masters { 192.168.4.12; }; // The master is at this address. file "
s/offsite.example.com.db"; // The file is here. notify
no; // Don't worry about NOTIFYing. allow-query {
any; }; // Allow anyone to query. };
Primitive load balancing can be achieved in DNS using multiple A records for one name.
For example, if you have three WWW servers with network addresses of 10.0.0.1, 10.0.0.2 and 10.0.0.3, a set of records like the following means that clients will connect to each machine one third of the time:
When a resolver queries for these records, BIND will rotate them and respond to the query with the records in a different order. This is known as cyclic or round-robin ordering. In the example above, the first client will receive the records in the order 1, 2, 3; the second client will receive them in the order 2, 3, 1; and the third 3, 1, 2. Most clients will use the first record returned and discard the rest.
For more detail on ordering responses, check the
rrset-order
substatement in the
options
statement in
RRset Ordering
.
DNS Notify is a mechanism that allows master nameservers to notify their slave servers of changes to a zone's data and that a query should be initiated to discover the new data.
DNS Notify is fully documented in RFC 1996. See also the description of the zone option
also-notify
in
Zone Transfers
. More information about
notify
can be found in Boolean Options
.
There are several indispensable diagnostic, administrative and monitoring tools available to the system administrator for controlling and debugging the nameserver daemon. We describe several in this section
The domain information groper (
dig
) is a command line tool that can be used to gather information from the Domain Name System servers. Dig has two modes: simple interactive mode for a single query, and batch mode which executes a query for each in a list of several query lines. All query options are accessible from the command line.
dig [@server] domain [<query-type>] [<query-class>] [+<query-option>] [-<dig-option>] [%comment]
The usual simple use of dig will take the form
dig @server domain query-type query-class
For more information and a list of available commands and options, see the dig man page.
The
host
utility provides a simple DNS lookup using a command-line interface for looking up Internet hostnames. By default, the utility converts between host names and Internet addresses, but its functionality can be extended with the use of options.
nslookup
is a program used to query Internet domain nameservers.
nslookup
has two modes: interactive and non-interactive. Interactive mode allows the user to query nameservers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.
nslookup [-option ...] [host-to-find | -[server]]
Interactive mode is entered when no arguments are given (the default nameserver will be used) or when the first argument is a hyphen (-) and the second argument is the host name or Internet address of a nameserver.
Non-interactive mode is used when the name or Internet address of the host to be looked up is given as the first argument. The optional second argument specifies the host name or address of a nameserver.
The options listed under the "set" command (see the
nslookup
man page for details) can be specified in the
.nslookuprc
file in the user's home directory if they are listed one per line. Options can also be specified on the command line if they precede the arguments and are prefixed with a hyphen. For example, to change the default query type to host information, and the initial time-out to 10 seconds, type:
nslookup -query=hinfo -timeout=10
For more information and a list of available commands and options, see the
nslookup
man page.
Administrative tools play an integral part in the management of a server.
The remote name daemon control (
rndc
) program is a program that allows the system administrator to control the operation of a nameserver. If you run
rndc
without any options it will display a usage message.
rndc [-p port] [-m] server command [command ...]
For more information and a list of available commands and options, see the
rndc
man page.
Return to BINDv9 Administrator Reference Manual