Configure-BIND DNS server

 
                               DNS


Introduction on BIND
BINDor named is the most widely used DNS software on the Internet. The name originates as an acronym from Berkeley Internet Name Domain. The Internet Domain Name System (DNS) consists of the syntax to specify the names of entities in the Internet in a hierarchical manner, the rules used for delegating authority over names, and the system implementation that actually maps names to Internet addresses. DNS data is maintained in a group of distributed hierarchical databases.
It stores information for mapping Internet host names to IP addresses and vice versa, mail routing information, and other data used by Internet applications.

Installation and Configuration of BIND
#cd
# unzip bind-9.3.2.tar.gz
# tar -xvf bind-9.3.2.tar
-To Download and extract

# cd bind-9.3.2/
# ./configure --prefix=/usr/local --disable-ipv6
# make && make install
-To configure and install BIND

# mkdir -p /chroot/named
# groupadd named
# useradd -g named -d /chroot/named -s /bin/true named
# passwd -l named
-To create a user 'named' with home directory '/chroot/named'

# cd /chroot/named
# mkdir dev etc logs conf
# mkdir -p var/run
# mknod dev/null c 1 3
# mknod dev/zero c 1 5
# mknod dev/random c 1 8
# cp /etc/localtime etc
-To create directories and device files for the working of bind.

# ln -s /chroot/named/etc/named.conf /etc/named.conf
-To create the named.conf file which the main configuration file of BIND

Add the following contents in the /etc/named.conf file

options {
directory "/conf";
pid-file "/var/run/named.pid";
statistics-file "/var/run/named.stats";
dump-file "/var/run/named.db";
recursion yes;
version "Just bad luck";
};

# onedomain.com
zone "onedomain.com" in {
type master;
file "onedomain.for";
notify no;
};

#twodomain.com
zone "twodomain.com" in {
type master;
file "twodomain.for";
notify no;
};


Create a file 'onedomain.for' in '/chroot/named/conf' with the following contents in it. It is the zone file for onedomain.com

;onedomain.for
;
$TTL 86400

@ IN SOA ns.onedomain.com. mail.onedomain.com (
450 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

@ IN NS ns.onedomain.com.
ns IN A 192.168.1.193
@ IN A 192.168.1.193
www IN CNAME onedomain.com.

Create a file 'twodomain.for' in '/chroot/named/conf' with the following contents in it. It is the zone file for twodomain.com

;twodomain.for
;
$TTL 86400

@ IN SOA ns.twodomain.com. mail.twodomain.com (
451 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

@ IN NS ns.twodomain.com
ns IN A 192.168.1.194
@ IN A 192.168.1.194
www IN CNAME twodomain.com.


# chown named:named /chroot/named
# chown -R named:named /chroot/named/var
# chmod 700 /chroot/named


# named-checkzone onedomain.for /chroot/named/conf/onedomain.for
zone onedomain.for/IN: loaded serial 450
OK
# named-checkzone twodomain.for /chroot/named/conf/twodomain.for
zone twodomain.for/IN: loaded serial 451
OK



# named-checkconf /etc/named.conf
-To check the configuration file
# /usr/local/sbin/named -t /chroot/named -u named -c /etc/named.conf
-To start named service.

# ps -fCnamed
UID PID PPID C STIME TTY TIME CMD
named 17611 1 0 11:34 ? 00:00:00 /usr/local/sbin/named -t /chroot/named -u named -c /etc/named.conf
-To check whether the named service is started or not.



# nslookup www.onedomain.com
Server: 127.0.0.1
Address: 127.0.0.1#53

www.onedomain.com canonical name = onedomain.com.
Name: onedomain.com
Address: 192.168.1.193


# nslookup www.twodomain.com
Server: 127.0.0.1
Address: 127.0.0.1#53

www.twodomain.com canonical name = twodomain.com.
Name: twodomain.com
Address: 192.168.1.194

# dig +short @192.168.1.193 -c CH -t txt version.bind
"Just bad luck"




This entry was posted by Unknown. Bookmark the permalink.

3 thoughts on “Configure-BIND DNS server”

  1. When you check /etc/named.conf file using named-checkconf you may get the following error

    named.conf:2: change directory to '/conf' failed: file not found

    named.conf:2: parsing failed

    To change parsing failed error, just make 'not found' directory under '/' . Here it is 'conf'
    Use the following command to remove the error

    #mkdir /conf

  2. http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch18_:_Configuring_DNS#Introduction


    This link will give you more information on creating views and zones...

  3. http://tldp.org/HOWTO/Chroot-BIND-HOWTO-1.html

    This link will give you a brief idea on creating a Jail environment.

    The DNS configuration in this post is creating in a Jail environment.

Leave a Reply