BIND

From LQWiki
Jump to: navigation, search

BIND (Berkeley Internet Name Domain) is the most widely used DNS server for Linux. It supports IPv4 and IPv6. Employing BIND comprises three configurations:

  • BIND resolver it the client
  • BIND name server (named)
  • name server database

As of this writing BIND 9 is the most current version.

set up BIND

What we want

We want our computer to be a DNS Server, so, to deliver IP Adresses for hostnames. This can be tested with the command host. We will set up name resolution for a computer called test. If you now type

host test

you get an error message like that:

Host test not found: 3(NXDOMAIN)

This tutorial shows you how to change this. It lasts about 30 minutes.

What to do

1. Install BIND (Berkeley internet naming daemon) from your Linux-Distribution as described at installing software or from

http://www.isc.org/products/BIND/bind9.html (2003-06-19 )

2. Create /etc/named.conf with these lines:

# Sample configuration for BIND 9
# not for productive environments, only for teaching purposes
 
options
{
  directory "/var/lib/named";
  forwarders {212.185.255.231;194.25.2.129;};
};
 
zone "local" in
{
  type master;
  file "local.zone";
};

and create /var/lib/named/local.zone with these lines:

local.          IN SOA          test   root.localhost. (
                                1999092901      ; serial
                                1D              ; refresh
                                2H              ; retry
                                1W              ; expiry
                                2D )            ; minimum
 
                IN NS           test
  
test		IN A		172.16.50.1

3. Add the following line to your /etc/resolv.conf:

nameserver 127.0.0.1
search local

4. restart your network, for example this way:

/etc/init.d/network restart

5. Start your nameserver like that:

/etc/init.d/named start

Result

Test your nameserver with this command:

host test

The output should be like that:

test.local has address 172.16.50.101

From this, you can tell that your nameserver works.

The configuration file named.conf

type - This keyword determines the type of zone. You can use master or hint. If a host is not found in the zone, and the type of the zone is hint, other nameservers will be contacted. If the type is master, no other nameserver will be searched for that host.

forwarders - This defines the IP addresses for the server to query for answers not already in its own cache (or not authoritative for, such as the "master" defined in the example above). This feature is not needed, as the named server can look for the answer(s) itself.

external links