My Weblog

Just another WordPress.com weblog

Configuring BIND on RedHat (DNS under Linux) – Part 1

Configuring BIND on RedHat (DNS under Linux)
Part 1 – Installing BIND on RedHat

Written by Tony Bhimani
July 21, 2004

Requirements
RedHat Linux 9
BIND 9.2.1

This tutorial describes the steps for configuring BIND 9.2.1 on RedHat Linux 9. It should be valid for other versions of BIND as well as some different distros of Linux. I will be going over setting it up as a primary and secondary name server. This tutorial spans three parts. In part 1 I will go over installing BIND and verifying the service will start on boot-up.

The first thing we will need to do is determine if BIND is already installed on your system. The method I use is to check through the RPM Package Manager. This will not work if you downloaded the BIND source code and compiled it.

Type the following at the command prompt:
rpm -qa | grep -i bind
rpm -qa | grep -i caching

If BIND is installed you should get something similar to this (ignore ypbind…it is unrelated to BIND) and you will want to skip to part 2 of this tutorial.

image1.gif

If BIND is not installed you will get something similar to the below image and you should keep reading.

image3.gif

We need to install BIND and have a few options here. We can download the source code and compile it, but we won’t take that route. We will want to install the RPM’s to keep things simple. There are a couple sources we can get the RPM’s from: download them or use the RedHat 9 CD’s. If you don’t have the RedHat 9 CD’s then you will need to download the BIND RPM’s. If you do have the CD’s then you can mount and install.

If you are not root, type su – and press enter and type in the root password (stay logged in as root for the remainder of this tutorial). Next switch to a directory where you can store the RPM’s. A good place is in your home directory under a folder called RPM. You can accomplish this by issuing the following commands.

cd ~
mkdir RPM
cd RPM

Choose your install method:

Install from CD
Download and Install the BIND RPM’s

Install from CD

The BIND RPM’s are located on the first CD and the caching name server and BIND development RPM’s are located on the second CD. What we will do is mount the first CD, copy of BIND RPM’s to the RPM folder we created, and unmount the CD. Then mount the next CD and copy the caching name server and BIND development RPM’s to the RPM folder and unmount that CD. Then we will proceed to the install section.

Put the RedHat 9 CD 1 in your CD-ROM drive and issue the following command.

mount -t iso9660 /dev/cdrom /mnt/cdrom

If your drive mounted then you should see something similar to the following.

image2.gif

Next copy the BIND RPM’s to your RPM folder.
cp /mnt/cdrom/RedHat/RPMS/bind-*.rpm .

image1.gif

We are now done with CD 1, so we can unmount it.

umount /mnt/cdrom

Put the RedHat 9 CD 2 in your CD-ROM drive and issue the following command.

mount -t iso9660 /dev/cdrom /mnt/cdrom

Next copy the caching name server and BIND development RPM’s to your RPM folder.

cp /mnt/cdrom/RedHat/RPMS/bind-devel-9.2.1-16.i386.rpm .
cp /mnt/cdrom/RedHat/RPMS/caching-nameserver-7.2-7.noarch.rpm .

image5.gif

Now unmount the CD-ROM with umount /mnt/cdrom and take the CD out of the drive.

When you are done, do a directory list (ls) and you should have all four files.

image6.gif
Now that you have the RPM’s it is time to actually install them. Go to the installation part.

Download and Install the BIND RPM’s

I offer you two ways of downloading the RPM’s. Using wget or using a FTP client. In my opinion using wget is far easier then using the basic FTP client that comes with RedHat. With wget you just supply the URL and it fetches the file for you. With the basic FTP client you have to issue more commands than I’m sure you’d like to. First thing you should do is check if you have wget on your system. Type wget and press enter. If you don’t get a command not found error then it is installed and you should proceed to the wget section. If you do get the command not found error, you have no choice but to use the FTP client. In either case you will need to know where to download the RPM’s from.

RedHat provides a list of mirror sites at http://www.redhat.com/download/mirror.html where you can choose where to download the RPM’s (or ISO images) from. The server we will use is mirror.mcs.anl.gov and the full path to the RPM’s isftp://mirror.mcs.anl.gov/pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/.

We want to download the following files:
bind-9.2.1-16.i386.rpm
bind-devel-9.2.1-16.i386.rpm
bind-utils-9.2.1-16.i386.rpm
caching-nameserver-7.2-7.noarch.rpm

Download by wget
Download by FTP Client

Download by wget

Issue these commands one at a time.

wget ftp://mirror.mcs.anl.gov/pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/bind-9.2.1-16.i386.rpm
wget ftp://mirror.mcs.anl.gov/pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/bind-devel-9.2.1-16.i386.rpm
wget ftp://mirror.mcs.anl.gov/pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/bind-utils-9.2.1-16.i386.rpm
wget ftp://mirror.mcs.anl.gov/pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/caching-nameserver-7.2-7.noarch.rpm

You should get something similar to the following for each file you download.

image7.gif

When you are done, do a directory list (ls) and you should have all four files.

image6.gif
Now that you have the RPM’s it is time to actually install them. Go to the installation part.

Download by FTP Client

I guess you don’t have wget. No problem! FTP isn’t that bad, there is just more typing involved. Type the following commands to download the RPM’s.

ftp mirror.mcs.anl.gov

It then asks for a username, type anonymous and press enter. Then it will ask for your email address as a password. Type in your email address and press enter.

Once you are logged in, issue these commands one at a time.

bin
hash
cd /pub/redhat/redhat/linux/9/en/os/i386/RedHat/RPMS/
get bind-9.2.1-16.i386.rpm
get bind-devel-9.2.1-16.i386.rpm
get bind-utils-9.2.1-16.i386.rpm
get caching-nameserver-7.2-7.noarch.rpm

During each file download you will see a bunch of # symbols scroll by. This is just a text based progress bar. I find it helpful to let me know if a download has stalled. If you don’t want to use the hash marks, type hash off and press enter.

You should receive screens similar to the following.

image8.gif
image9.gif

After you have retreived all four files, type quit and press enter. Do a directory list (ls) and you should have all four files.

image6.gif

Now that you have the RPM’s it is time to actually install them.

Installing the BIND RPM’s

Whichever path you chose, whether downloading the RPM’s or installing from CD, you should be in the same directory where they are located. To install the RPM’s you issue the following command.

rpm -ivh bind-*.rpm caching-nameserver-7.2-7.noarch.rpm

You should get something a screen similar to the following.

image10.gif
To verify the RPM’s installed successfully, issue the following commands.

rpm -qa | grep -i bind
rpm -qa | grep -i caching

BIND should now be installed and you should get a screen similar to the following.

image1.gif

Now we need to make sure the BIND service starts upon boot-up. To do this we will use chkconfig and tell the OS to start named (BIND) to start on runlevels 3 and 5. For more information about runlevels and the Linux boot process visit this site http://www.siliconvalleyccie.com/linux-hn/runlevels.htm.

Issue the following commands to chkconfig to turn named (BIND) on for runlevels 3 and 5. Then we will verify they have been turned on.

chkconfig –levels 35 named on
chkconfig –list | grep -i named

image11.gif

I should also mention instead of using chkconfig you could have used the RedHat Text Mode Setup Utility. From the command line type setup and press enter. Scroll down to System Services and press enter. Scroll down to named and press the spacebar to put a check on it. Press tab, enter, tab, tab, enter. You should be back to the prompt. Verify that named will boot-up. Note: If you didn’t install X Windows, runlevel 5 may not be turned on. This is ok because runlevel 5 is Multi-User GUI mode.

Everything looks good. Now we will start BIND and verify it is running.

/etc/init.d/named start
ps aux | grep -i named

image12.gif

That’s all for part 1. In part 2 I will cover setting up BIND as a primary name server for a single zone.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: