BIND is the Berkeley Internet Name Domain, the most widely accepted and used DNS server on the internet today. Currently BIND is on version 9 which has been written again from scratch in order to support new features, improve on the security of previous versions and overcome problems with previous code bases.
Binary packages are available on almost all major distributions, ready to be installed from your package manager.
apt-get (Debian):
sudo apt-get install bind9
yum (Red Hat Based):
yum install bind
If you have a distribution other than the ones covered please check their documentation on how to install packages. If your distribution does not provide a package you can find the source at https://www.isc.org/software/bind
This section was written only from the perspective of a Debian based system. Although these instructions will most probably work on other distributions it is not guaranteed.
BIND can be set-up in a number of ways, each providing different functions to the user. The most common configurations are to use BIND for a primary and secondary DNS servers for the domain(s) on the server.
A primary nameserver holds the zone files for the domains that it serves and will answer queries for these domains, it also notifies secondary nameservers when a zone is changed. A secondary server reads the zone information from a domains primary nameserver, it is only used to answer queries for the domains it serves when the primary nameserver is unreachable.
Every domain should have a primary nameserver and at least one secondary nameserver in order to provide redundancy in cases where the primary becomes unreachable for whatever reason.
First of all we need to let BIND know what domains it will be serving and where it can find the zone file for these domains. The list of zones that BIND is to use are stored in /etc/bind/named.conf.local and the following syntax is used to define a zone:
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
This code snippet tells BIND that it is the master (primary namserver) for the zone named example.com and that the configuration file for this domain is at /etc/bind/db.example.com
The next step is to create the zone file for this zone so that BIND can provide answers for any queries it receives for this zone. BIND comes shipped with a zone file for local and this is a good place to start working from when setting up a new zone. In order to use this as a base for your new zone just copy /etc/bind/db.local to /etc/bind/db.example.com, once this is done we can edit db.example.com to tell BIND what the zone looks like.