How to configure bind on CentOS 6.3

DNS stands for Domain Name System and is a a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. In other words DNS translate human readable hostnames such as test.org into machine readable ip addresses such as 89.36.25.239.

Preliminary notes
- Server Name: ns.test.org
- Server IP: 172.20.30.1/24

Install required software packages
[codesyntax lang="bash"]

yum install bind bind-libs bind-utils

[/codesyntax]

Set BIND service to start on system boot
[codesyntax lang="bash"]

chkconfig named on

[/codesyntax]

Start named service for generating some default configuration files.
/etc/init.d/named start

Note: In case the command above hangs there is an entropy problem. You should install haveged daemon. More details here.

If you don't want to install haveged daemon there is a workaround:
[codesyntax lang="bash"]

rndc-confgen -a -r /dev/urandom

[/codesyntax]

Edit main configuration file and add zone entry of www.test.org
[codesyntax lang="bash"]

vim /etc/named.conf

[/codesyntax]

options {
        forwarders { 8.8.8.8; 8.8.4.4; };
        listen-on port 53 { any; };
        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 { any; };
        allow-query-cache { any; };
};

logging {
        channel default_debug {
            file "data/named.run";
            severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};
zone "test.org" {
        type master;
        file "test.org";
};
zone "30.20.172.in-addr.arpa" {
        type master;
        file "30.20.172.in-addr.arpa";
};

Create Zone files which we mentioned in named.conf file
[codesyntax lang="bash"]

cd /var/named
vim /var/named/test.org

[/codesyntax]

$ORIGIN test.org.

$TTL 1H

test.org.          IN SOA ns.test.org. root.test.org. (
                                2012062600      ; serial
                                12H             ; refresh
                                2H              ; retry
                                1W              ; expiry
                                2D )            ; minimum

test.org.       IN    NS   ns.test.org.

ns.test.org.    IN    A    172.20.30.1

www10          IN    A    172.20.30.10
www11          IN    A    172.20.30.11
www12          IN    A    172.20.30.12
www13          IN    A    172.20.30.13
www14          IN    A    172.20.30.14
www15          IN    A    172.20.30.15

[codesyntax lang="bash"]

vim /var/named/30.20.172.in-addr.arpa

[/codesyntax]

$ORIGIN 30.20.172.in-addr.arpa.

$TTL 2D

@          IN SOA ns.test.org. root.test.org. (
                                2012062600      ; serial
                                12H             ; refresh
                                2H              ; retry
                                1W              ; expiry
                                2D )            ; minimum

@     IN    NS     ns.test.org.

1     IN    PTR    ns.test.org.

10    IN    PTR    www10.test.org.
11    IN    PTR    www11.test.org.
12    IN    PTR    www12.test.org.
13    IN    PTR    www13.test.org.
14    IN    PTR    www14.test.org.
15    IN    PTR    www15.test.org.

Restart named service
[codesyntax lang="bash"]

/etc/init.d/named restart

[/codesyntax]

Update /etc/resolv.conf file
[codesyntax lang="bash"]

echo "search test.org" > /etc/resolv.conf
echo "nameserver 127.0.0.1" >> /etc/resolv.conf

[/codesyntax]

Source: http://www.broexperts.com/2012/03/linux-dns-bind-configuration-on-centos-6-2/

Scrie si tu o vorbulita


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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