Building a simple Domain Name Server (DNS) (Centos63)

These are my notes for building a very basic DNS server using Centos 6.3.

Here we are using centos63-005.troyski.homeip.net as a DNS server to allow our other CentOS servers to get IP’s without having to administer the /etc/hosts files on each server. This is a virtual server running in VirtualBox on my Macbook Air

yum -y install bind bind-utils
service named start

vi /etc/named.conf…

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
 
options {
        //listen-on port 53 { 127.0.0.1; };
        //listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        //allow-query     { localhost; };
        recursion yes;
 
        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;
 
        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
 
        managed-keys-directory "/var/named/dynamic";
};
 
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
 
zone "." IN {
        type hint;
        file "named.ca";
};
 
zone "troyski.homeip.net" {
        type master;
        file "troyski.homeip.net.fwd";
};
 
zone "11.168.192.in-addr.arpa" {
        type master;
        file "troyski.homeip.net.rev";
};
 
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

vi /var/named/troyski.homeip.net.fwd

$TTL 3D
@       IN      SOA     centos63-005.troyski.homeip.net.     root.troyski.homeip.net. (12 4h 1h 1w 1h)
@       IN      NS      centos63-005.troyski.homeip.net.
centos63-004                            IN      A       192.168.11.22
centos63-005                            IN      A       192.168.11.24
www                                     IN      A       192.168.11.23
centos63-006                            IN      A       192.168.11.25
centos63-007                            IN      A       192.168.11.27

vi /var/named/troyski.homeip.net.rev

$TTL 3D
@      SOA     centos63-005.troyski.homeip.net.     root.troyski.homeip.net. (12 4h 1h 1w 1h)
@      IN      NS      centos63-005.troyski.homeip.net.
24     IN      PTR     centos63-005.troyski.homeip.net.
22     IN      PTR     centos63-004.troyski.homeip.net.
23     IN      PTR     www.troyski.homeip.net.
25     IN      PTR     centos63-006.troyski.homeip.net.
27     IN      PTR     centos63-007.troyski.homeip.net.
service named restart
chkconfig named on

Now just change each nodes’ /etc/resolv.conf to

domain troyski.homeip.net
search troyski.homeip.net
nameserver 192.168.11.24
Published
Categorized as FAQs, Linux

By troyski

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

This site uses Akismet to reduce spam. Learn how your comment data is processed.