How to Configure Master DNS

Domain Name System (DNS) is a database system that translates a computer's fully qualified domain name into an IP address. Networked computers use IP addresses to locate and connect to each other, but IP addresses can be difficult for people to remember. For example, on the web, it's much easier to remember the domain name  than it is to remember its corresponding IP address (192.168.0.1). DNS allows you to connect to another networked computer or remote service by using its user-friendly domain name rather than its numerical IP address. Conversely, Reverse DNS (rDNS) translates an IP address into a domain name.

 

Step-1 First you need to run following command to install necessary packages for DNS (BIND).

[ root@server~ ]#  yum   install  bind  bind-chroot

 

Step-2  Now edit Main configuration file and make some necessary changes.

 

[root@server~ ]#  vim    /etc/named.conf

options {

        listen-on port 53 { 127.0.0.1; 192.168.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";

        query-source    port 53;

        query-source-v6 port 53;

        allow-query    { localhost; 192.168.0.0/24; };

};

 

zone "leolinux.in" IN {

    type master;

    file "leolinux-forward.zone";

};

 

zone "0.168.192.in-addr.arpa" IN {

    type master;

    file "leolinux-reverse.zone";

};

 

 

Step-3  Now you have to create forward zone file and its record.

[root@server~ ]#  vim /var/named/leolinux-forward.zone

 

$TTL  86400

@  IN  SOA  server.leolinux.in.  root.server.leolinux.in. (

                                                        2007022700 ; Serial

                                                        28800             ; Refresh

                                                        14400             ; Retry

                                                        3600000        ; Expire

                                                        86400 )          ; Minimum

 

@                  IN    NS          server.leolinux.in.

server         IN    A            192.168.0.1

station10    IN    A            192.168.0.10

station20    IN    A            192.168.0.20

station30    IN    A            192.168.0.30

www             IN     CNAME       server.leolinux.in

webmail      IN     MX    10      server.leolinux.in

 
 

Step-4  Create reverse lookup zone file and its record.

 

[root@server~ ]#  vim /var/named/leolinux-reverse.zone

 

$TTL  86400

@  IN  SOA  server.leolinux.in.  root.server.leolinux.in. (

                                                        2007022700 ; Serial

                                                        28800             ; Refresh

                                                        14400             ; Retry

                                                        3600000        ; Expire

                                                        86400 )          ; Minimum

 

@                  IN    NS          server.leolinux.in.

1                   IN    PTR        server.leolinux.in.

10                IN    PTR        station10.leolinux.in.

20                IN    PTR        station20.leolinux.in.

30                IN    PTR        station30.leolinux.in.

 

 

Step-5 Change owner and group ship of zone files.

 

[root@server~ ]#  chown   root:named     /var/named/leolinux-reverse.zone

[root@server~ ]#  chown   root:named     /var/named/leolinux-forward.zone

 

Step-6  Enable and start the DNS (named) service.

 

[root@server~ ]#  chkconfig   named   on

[root@server~ ]#  service    named    restart