Configuring BIND


Now that you have a current version of BIND installed, you're ready to begin configuration. The name daemon, named, is configured with one main file, depending on how it was installed. This file is usually called /etc/named.conf or /usr/local/etc/named.conf; however, it might be called something else if it was configured differently. In this file, you perform the basic configuration of your named as well as enumerate the zones you are going to serve and the files in which they are contained.

Before you can proceed, four files must be set up. First, you'll need to set up a caching-only nameserver. This is good to have if you are on the wrong end of a slow network connection with no other nameservers on your network.

The files discussed in the following sections can be found on this book's Web site in the caching.tar.gz or caching.zip file.

named.conf

named.conf is the main configuration file. You need to place it in the right location, so use the following commands:

 // Config file for caching-only nameserver options {         directory "/var/named";         // Uncommenting this might help if you have to go through a         // firewall and things are not working out:         // query-source port 53; }; zone "." {         type hint;         file "root.hints"; }; zone "0.0.127.in-addr.arpa" {         type master;         file "pz/127.0.0"; }; 

In the previous code, the directory command names the directory in named.conf in which named will look for the filenames. Because no default directory exists, named will look for the files in the current directory if you do not name a directory. /var/named, /usr/named, and /usr/local/named are all used, among others. Find a name that fits your partitioning scheme. The other sections in the file load files you will examine soon.

One other point I should make is that named.conf is similar to a computer program, with BIND acting as the compiler. If you make even the smallest syntax error, the file will be void and invalid.

root.hints

As you will recall from Chapter 1, "DNS Concepts," you need to know where to find the root nodes of DNS, which are called the root nameservers. You can use the root.hints file to do so. You place it in the directory you named in named.conf:

 ; ; There might be opening comments here if you already have this file. ; If not, don't worry. ; .                       6D IN NS        G.ROOT-SERVERS.NET. .                       6D IN NS        J.ROOT-SERVERS.NET. .                       6D IN NS        K.ROOT-SERVERS.NET. .                       6D IN NS        L.ROOT-SERVERS.NET. .                       6D IN NS        M.ROOT-SERVERS.NET. .                       6D IN NS        A.ROOT-SERVERS.NET. .                       6D IN NS        H.ROOT-SERVERS.NET. .                       6D IN NS        B.ROOT-SERVERS.NET. .                       6D IN NS        C.ROOT-SERVERS.NET. .                       6D IN NS        D.ROOT-SERVERS.NET. .                       6D IN NS        E.ROOT-SERVERS.NET. .                       6D IN NS        I.ROOT-SERVERS.NET. .                       6D IN NS        F.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET.     5w6d16h IN A    192.112.36.4 J.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.10 K.ROOT-SERVERS.NET.     5w6d16h IN A    193.0.14.129 L.ROOT-SERVERS.NET.     5w6d16h IN A    198.32.64.12 M.ROOT-SERVERS.NET.     5w6d16h IN A    202.12.27.33 A.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.4 H.ROOT-SERVERS.NET.     5w6d16h IN A    128.63.2.53 B.ROOT-SERVERS.NET.     5w6d16h IN A    128.9.0.107 C.ROOT-SERVERS.NET.     5w6d16h IN A    192.33.4.12 D.ROOT-SERVERS.NET.     5w6d16h IN A    128.8.10.90 E.ROOT-SERVERS.NET.     5w6d16h IN A    192.203.230.10 I.ROOT-SERVERS.NET.     5w6d16h IN A    192.36.148.17 F.ROOT-SERVERS.NET.     5w6d16h IN A    192.5.5.241 

This file simply enumerates the rootservers and their addresses with standard NS and A records. The file is called hints because its contents are not taken as gospel; everything in it is simply a hint. Your named will check for itself how things really are and then develop a preference for one nameserver based on its track record for response time.

However, the file needs to be maintained so that, after several years of neglect, it does not fall completely out of sync with reality and no longer provides a usable starting point for your named file to resolve queries. For more information, see Chapter 3, "Maintenance and Enhancements."

pz/127.0.0

This file is required for the simple reason that some software, especially the popular DNS program nslookup, will not work unless it can perform a reverse lookup of the nameserver's address. The pz part of the filename is a directory name, meaning the file resides in the subdirectory pz. This subdirectory is so named because primary zone used to be the name of what is now known as a master zone. Some DNS administrators like to organize their zone files into separate directories master zones, and slave, or secondary, zones. Zone files have several different naming conventions. If you are exploring an existing BIND installation while reading this, you might find a completely different naming convention in use. If so, you might want to continue using the naming convention currently in use at your site.

As shown in the previous named.conf file, a master zone exists. Using the naming convention I prefer, it would be placed in the pz directory and given the name of the network in which it resolves hosts: 127.0.0. The following is an example:

 ; $ORIGIN 0.0.127.in-addr.arpa. $TTL 1D ; @               IN      SOA     ns.penguin.bv. hostmaster.penguin.bv. (                                 1       ; Serial                                 8H      ; Refresh                                 2H      ; Retry                                 1W      ; Expire                                 1D)     ; Minimum TTL                         NS      ns.penguin.bv. 1                       PTR     localhost. 

The first line of the previous code explicitly states that the domain name, or origin, of this zone is 0.0.127.in-addr.arpa. This is the name of the reverse zone for the 127.0.0 network. This origin is also implied by the argument to the zone directive in the named.conf file, which makes it superfluous. What the file defines also should be obvious from the filename. The $ORIGIN line is considered good form by many, though, because it explicitly documents what the file you're looking at is about. Because it's just a matter of taste, I'll follow my own preference and henceforth not include it in zone files in this book.

The $TTL 1D line states that records looked up and cached in a caching server from this file have a TTL (Time To Live) of one day. The cached entry expires after 24 hours and is removed from the cache when that much time has passed.

The line starting with @ defines the SOA RR, which spans several lines and ends on the line with the closing parenthesis. This RR is explained later in this chapter in the section "A Zone."

The last line, which starts with a 1, defines a PTR record for the domain name 1.0.0.127. in-addr.arpa. It should point to localhost., the traditional name for the loopback interface address on UNIX systems.



The Concise Guide to DNS and BIND
The Concise Guide to DNS and BIND
ISBN: 0789722739
EAN: 2147483647
Year: 1999
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net