Bind Setup

From Linuxhelp Wiki

Author:Joey
Created On:November 20th, 1999
Updated On:September 19th, 2003

Bind, which stands for Berkeley Internet Name Domain, is the leading name server software on the internet and to make it even better, it's free. If you are unsure of what a name server is, then you probably shouldn't be reading this :)

Before we go ahead with the installation and configuration of Bind, there are a few things that need to be noted. First off, Bind has a history of having security "issues" so if you do install Bind, please please please keep it updated.

Secondly, if you plan on using this name server to provide name service on a domain name, your name server must be registered by the various TLD Registries - VeriSign - COM/NET, PIR - ORG, NEULEVEL - .BIZ etc.

Depending on your setup, there are a few ways to do this. If you own a domain name, lets say example.com and you wish to create ns1.example.com, this must be done by contacting your Domain registrar and having them register the hostname as a valid name server. If you are not sure who your Registrar is simply visit http://www.betterwhois.com and perform a WHOIS lookup on the domain.

If you do not have a domain name but you have a hostname with a static IP from your ISP, you will have to get your ISP to contact their registrar and have them register your hostname with the registry before you can use your nameserver on domains. Depending on who your ISP is, they might not do this for you.

If your domain name is registered through Tucows then you can register your name server without the interaction of your registrar. Simply log into https://manage.opensrs.net, click on the "Name Servers" link and then click on the link that reads "If you want to create or modify a name server that is based on example.com, click here". From that page you can go ahead and register the name server with the VeriSign .COM/.NET registry.

Now that all that jazz is taken care of, let's get to the installation part. At the time of writing, the current stable release of BIND is 9.2.2, which can be found at http://www.isc.org/products/BIND/bind9.html or by visiting any one of their Mirror Sites.

I'm going to leave the installation up to you. If you want to install Bind from the source, the file you are looking for is bind-9.2.2.tar.gz. I currently run Red Hat Linux and prefer to install the bind RPM file. This way if there ever is a security advisory for Bind my system will automatically update to the latest version using Red Hat's up2date network.

To install the RPM version, simply find bind on your installation CDROM or download the RPM from http://www.rpmfind.net. Once you've found it or downloaded it, run the following as root: rpm -Uvh bind-*.rpm

To install the DEB version, simply find bind on your installation CDROM or run the following as root: apt-get install bind

If you are installing Bind from the source, download and untar bind-9.2.2.tar.gz, change into the newly created directory and open up the INSTALL file with your favorite editor (nano, pico, vi, joe etc) for installation instructions. Additionally, you can find installation instructions at http://www.isc.org/products/BIND/bind9.html.

Now would be a good time to have a look at some additional. You should have a look at the Bind 9 Administrator Reference Manual. As well, be sure to sign up to the Bind Mailing Lists. I cannot stress the importance of being up to date with Bind otherwise your machine will soon be owned by a script kiddy and when it is, please do not come crying to me :)

Now we can move on to the configuration part of setting up Bind. To make things easy, I've put together a tarball of the named config file and a few zone files to get you started. You can download the tarball from here. Extract this tarball and it will create a new directory called named. Move this directory to the /var directory, thus creating /var/named.

You will find the following files in my bind.tar.gz. You will have to edit each of these files to reflect your own configuration, namely, wherever I have "example.com", simply replace it with your domain name. Once that is done, move the named.conf into the /etc directory.

named.ca
0.0.127.in-addr.arpa.zone
localhost.zone
named.conf
example.com.zone
1.1.10.in-addr.arpa.zone
106.187.216.in-addr.arpa.zone

You also have to edit the 1.1.10.in-addr.arpa.zone and 106.187.216.in-addr.arpa.zone zone files and change it to your IP address. If your IP is 212.12.145.66, then rename the file to 145.12.212.in-addr.arpa.zone. In the file you will have to change the "1" in the

1     IN      PTR     yourdomain.com.

to 66

If you rename any of the files, such as the example.com.zone file, you must update the /etc/named.conf file with the new name.

Once everything is edited and peachy-keen you'll have to start Bind. How you do this depends on how you installed it. In Red Hat simply run /etc/init.d/named start as root.

Bind should now be running on your system. To test it out, type nslookup at the command prompt and you will get to another prompt that looks like the following:

(10:39pm)-(01/12/2001)-(pts/0)
(joey@linuxhelp.ca) ~# nslookup
Default Server:  ns1.yourISP.com
Address:  your.isps.dns.ip

> server 127.0.0.1
Default Server:  localhost
Address:  127.0.0.1 

> example.com
Server:  localhost
Address:  127.0.0.1

Name:    example.com
Address:  10.1.1.1

>

If you see something like the following, either you do not have the zone files properly set up or something is wrong with your named.conf file.

> yourdomain.com
Server:  localhost
Address:  127.0.0.1

*** localhost can't find yourdomain.com: Non-existent host/domain
>