3.14. DNS server configuration

As a starting point we use the default caching only nameserver configuration provided by SuSE. The caching only name server forwards requests to other nameservers provided by keyword forwarders and caches the answers for better performance. This configuration is good enough if you only need to resolve names and addresses in the Internet.

In order to use local name resolution too, we add two new zone records: residency.local (name to IP address), and 100.168.192.rev for reverse name resolution (IP address to name). For debugging, we add the logging section because it forces the name server daemon to log all requests in /var/log/messages.[18]

[18] For more information see BIND 9 Administrator Reference Manual: http://www.bind9.net/Bv9ARM.html

Example 3-27. /etc/named.conf
options {
directory "/var/named";
        forwarders {
                9.12.6.7;
                };
listen-on { any;};
notify no;
        forward first;
};

zone "localhost" in {
        type master;
        file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
        type master;
        file "127.0.0.zone";
};

zone "." in {
type hint;
        file "root.hint";
};

# You can insert further zone records for your own domains below.


logging {
        category queries {
                default_syslog;
                };
        category update {
                default_syslog;
                };
        };
zone "residency.local" {
        type master;
        file "/var/named/residency.local.hosts";
        };

zone "100.168.192.in-addr.arpa" {
type master;
        file "/var/named/100.168.192.rev";
        };

Now we create our own local zone files: residency.local, and for reverse lookup, 100.168.192.rev. We need a residency.local file in order to be able to resolve names to IP addresses.

Example 3-28. /var/named/residency.local
$ttl 38400 residency.local.   IN    SOA     192.168.100.110. root.p630sles. (
                        0310221736    ; serial
                        10800         ; refresh
                        3600          ; retry
                        604800        ; expiry
                        38400 )       ; minimum

residency.local.        IN      NS      192.168.100.81
$GENERATE 111-254      node-$   A       192.168.100.$
lpar8.residency.local.  IN      A       192.168.100.84
lpar7.residency.local.  IN      A       192.168.100.83
lpar6.residency.local.  IN      A       192.168.100.82
lpar5.residency.local.  IN      A       192.168.100.81
lpar4.residency.local.  IN      A       192.168.100.80
lpar3.residency.local.  IN      A       192.168.100.79
lpar2.residency.local.  IN      A       192.168.100.78
lpar1.residency.local.  IN      A       192.168.100.77
p630sles.residency.local.       IN      A       192.168.100.110

Important

Every time you change something in the zone file, you need to change the serial number in the second line.


In order to resolve addresses to names, we need a file for reverse name resolution. In this file, addresses are written in opposite order: 77.100.168.192, instead of 192.168.100.77.

Example 3-29. /var/named/100.168.192.rev
$ttl 38400100.168.192.in-addr.arpa.  IN    SOA    p630sles. root.p630sles. (
                        9998899999
                        10800
                        3600
                        604800
                        38400 )

100.168.192.in-addr.arpa.       IN      NS      p630sles

77.100.168.192.in-addr.arpa.    IN      PTR     lpar1.
78.100.168.192.in-addr.arpa.    IN      PTR     lpar2.
79.100.168.192.in-addr.arpa.    IN      PTR     lpar3.
80.100.168.192.in-addr.arpa.    IN      PTR     lpar4.
81.100.168.192.in-addr.arpa.    IN      PTR     lpar5.
82.100.168.192.in-addr.arpa.    IN      PTR     lpar6.
83.100.168.192.in-addr.arpa.    IN      PTR     lpar7.
84.100.168.192.in-addr.arpa.    IN      PTR     lpar8.
110.100.168.192.in-addr.arpa.   IN      PTR     p630sles.
$GENERATE 111-254 $            PTR     node-$.

Tip

The trick in both zone files is in the line starting with $GENERATE: it will assign all nodes above 111 names; that is, node-111, node-112 and so on. This is a useful feature in combination with a dhcpd server for a larger environment or cluster, because you do not need to add nodes one by one anymore.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.165.247