DNS Server

On the clients

Configuration

Edit /etc/resolv.conf to look like this:

search cafe.whatever.org
nameserver 192.168.0.10

On the server

Installation

 # apt-get install bind

Configuration

Perform the same configuration like for the clients.

If it isn’t already there, put the following lines in /etc/bind/named.conf:

// add local zone definitions here
include "/etc/bind/named.conf.local";

Then create a /etc/bind/named.conf.local like this:

zone "cafe.whatever.org." {
        type master;
        file "/etc/bind/cafe.whatever.file";
        allow-query { 192.168.0/24; 127.0.0/24; };
};

zone "0.168.192.in-addr.arpa." { type master; file "/etc/bind/0.168.192.file"; allow-query { 192.168.0/24; 127.0.0/24; }; };

This tells bind to answer forward queries from your local network and from the server itself and for domain names in the domain cafe.whatever.org. The corresponding info is in the file /etc/bind/cafe.whatever.file. Backward queries (“give me the name of this IP address: …”) are defined in the second record that works just like the first one.

By the way: the “.” at the end of the zone names is important.

Now, let’s create the necessary files. First cafe.whatever.file.

$TTL 86400
@ 86400                 IN              SOA cafe.whatever.org admin-mail.whatever.org (
                                                1               ; Serial No
                                                10800   ; Refresh 8 hours
                                                3600    ; retry 1 hour
                                                3600000 ; Expire 1000 hours
                                                86400 ) ; Minimum 24 hours
                        IN              NS                              ns
                        IN              A                               192.168.0.10
                        IN              HINFO                   INTEL-386       UNIX

ldap IN CNAME cafeserver

router IN A 192.168.0.1 cafeserver IN A 192.168.0.2

merkur IN A 192.168.0.100 venus IN A 192.168.0.101

Now, for the reverse direction, 0.168.192.file:

$TTL 86400
@ 86400         IN              SOA cafe.whatever.org admin-mail.cafe.whatever.org (
                                                1               ; Serial No
                                                10800   ; Refresh 8 hours
                                                3600    ; retry 1 hour
                                                3600000 ; Expire 1000 hours
                                                86400 ) ; Minimum 24 hours
                        IN      NS                                      ns
;

1 IN PTR router.cafe.whatever.org. 2 IN PTR cafeserver.cafe.whatever.org. 100 IN PTR merkur.cafe.whatever.org. 101 IN PTR venus.cafe.whatever.org.

The convention to change the serial no of the files after a change is totally unimportant in our setting because we only maintain a private IP address space and no other name server will ask ours for addresses.

The last file we have to change is named.conf.options.

Insert the following block inside of the block “options” (i.e. almost anywhere before the line that says };.

         forwarders {
                145.253.2.75;
                217.237.151.225;
                194.25.2.129;
         };

    forward only;

Then restart the name server:

 # /etc/init.d/bind restart

Test your configuration on the server by doing something like this:

 # ping router.cafe.whatever.org

Even if the router doesn’t answer the ping output should read something like this:

 # ping router.cafe.whatever.org
PING router.cafe.whatever.org (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: icmp_seq=0 ttl=255 time=0.5 ms

Lines like the last one indicate that the router is answering. Important for your question is the line above and there the IP address of the router.