Linux Online Advertisement
[ Register ]

[ Applications ]
[ Documentation ]
[ Distributions ]
[ Download Info ]
[ General Info ]
[ Book Store ]

Advertisement

[ Courses ]
[ News ]
[ People ]
[ Hardware ]
[ Vendors ]
[ Projects ]
[ Events ]
[ User Groups ]
[ User Area ]

Red Hat Linux Bible: Fedora and Enterprise Edition

[ About Us ]
[ Home Page ]
[ Advertise ]

Advanced Linux Course

Running A Name Server

The most popular software for translating hard to remember IP addresses (unless you're into mnemonics) into easy (or at least easier) to remember domain names is BIND. BIND is short for Berkeley Internet Name Domain and is software to provide DNS (Domain Name System) services. Here, we'll set up a very simple system that's adequate for a small business or home network.

Installing BIND

At the time of this writing, the most recent version of BIND is version 9. Major distributions have packaged BIND for easy installation.

Files Associated with BIND

BIND's configuration files can be found in /etc/bind

named.conf is the file that references the zone files for domains and reverse lookups for IPs.

named.conf

The forwarders are the DNS servers that BIND consults just in case it can't resolve names on its own. If you're using this in a small business or home setting, these numbers should be the DNS servers of your provider.

forwarders { X.X.X.X; Y.Y.Y.Y; Z.Z.Z.Z; };

After this line, we'll add the domains that we'll be hosting in our own server. That will make them resolve internally.

// add entries for other zones below here

zone "linux.ork" in {
        type master;
        file "/etc/bind/linux.zone";
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/linux.res";
};

The first entry is the domain plus its TLD (top level domain) as in our example linux.ork

The second entry is the IP minus the last number - all of which is written backwards. In our example, the local network is 192.168.0.X.

In the example, the first entry references the zone file. The second is the reverse lookup of the domain name.

Note

In the case where we have various domains hosted on our local network, we'll just have one file for reverse lookup.

*.zone File

@ IN SOA linux.ork. root.linux.ork. (
         2004091501     ; --- SERIAL NUM.
             604800     ; --- REFRESH
              86400     ; --- RETRY
            2419200     ; --- EXPIRES
             604800)     ; --- MINIMUM
  IN NS machine.linux.ork.
  IN NS www.linux.ork.
IN MX 10 machine.linux.ork.

machine IN A 192.168.0.20
www IN A 192.168.0.20

Let's look at what these numbers mean. SERIAL NUMBER needs to be a unique number and for this reason it's best to use a system based on the date plus two more digits. If you make changes to this file, you need to add one to the end numbers (eg. 02, 03 etc)

REFRESH is the time in seconds that the your nameserver should contact the primary name server. RETRY is there in case a primary nameserver goes off line. This is the time before your server waits to contact it again. If the primary name server becomes unreachable, then the last number, EXPIRE, kicks in and tells it that beyond this point, it should stop trying. Finally, MINIMUM is the length of time that the name server will keep domain cached. Here, like the REFRESH value, will keep it for a week.

IN NS are the distinct names for which machines are known.

IN MX 10 - is the name of the machine for purposes of sending email.

Finally, we indicate the name of the machine as an A record and its corresponding IP address. Here we can list all of the machines in the local network and their IP addresses.

machine IN A 192.168.0.20

*.res File

@ IN SOA linux.ork. root.linux.ork. (
         2003091501        ; --- SERIAL NUMBER
             604800        ; --- REFRESH
              86400        ; --- RETRY
            2419200        ; --- EXPIRES
             604800)       ; --- MINIMUM
   IN NS machine.linux.ork.
20 IN PTR www.linux.ork.
20 IN PTR machine.linux.ork.

These values are the same as the zone file, except at the end where you'll see we've changed '[name] + IN' for '20 IN PTR' + the machine's name.

Restart BIND

After any changes, you'll need to restart BIND. This is known as the 'named' daemon.



Comments: feedback (at) linux.org
Advertising: banners (at) linux.org
Copyright Linux Online Inc.
Compilation ©1994-2008 Linux Online, Inc.
All rights reserved.