Linux Server How To

How To Setup, Configure, Manage and Secure a Linux Server


Linux Server How To - Install the BIND DNS Server Using Apt-get


Installing the BIND DNS Server Using Apt-get

Installing the BIND DNS server using apt-get is an easy process that can be performed in less than one minute. Apt-get retrieves the selected packages from a source server on the internet and automatically installs the software you have selected for you, in this instance the BIND DNS server application. An internet connection is necessary for this process to be successfull. The commands documented here worked effectively on our Ubuntu Linux server and the majority of the information provided here will hold true for any Linux server using a distribution based on Debian.

To install the BIND Linux DNS server onto your Linux server simply log in and at the command prompt type-

john@ubuntu-linux-server:~$ sudo apt-get install bind9

In the instance of our Ubuntu Linux server this has installed named and its supporting tools in /usr/sbin and the configuration files including named.conf in /etc/bind. The result is a DNS server that is ready to perform lookups and cache the results but additional zone information will need to be added if you wish to provide authoritive answers for your own domains. The named.conf file contains basic information that BIND needs to function, most notably the file /etc/bind/db.root which contains information about the root nameservers which your DNS server will refer to when looking up domains recursively. There are also forward and reverse zones for the localhost as well as for the broadcast addresses and the zone files for these are in the /etc/bind directory.

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";



There are two include statements instructing BIND to read the contents of two additional files, named.conf.local and named.conf.options which are also located in the /etc/bind directory. Named.conf.local is essentially empty and is the file that we would add our local zones to. Named.conf.options includes additional configuration options such as working directories and forwarding nameservers. Any line in these configuration files that starts with // is essentially commented out and named will not attempt to read these files when loading them. Named.conf.options is the file shown below.

options {
directory "/var/cache/bind";

// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113

// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.

// forwarders {
// 0.0.0.0;
// };

auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};