Mar 6, 2010

DNS server Configuration

packages   : bind* , cach*

Service    : named

Configuration : /var/named/chroot/var/named/
        /var/named/chroot/etc/


1) Install the bind and cach packages
    #yum install bind* cach*

2) Set a static ip to the server machine
    #vi /etc/sysconfig/network-scripts/ifcfg-eth0
        IPADDR=151.8.99.27
        NETMASK=255.255.0.0

3) Restart the service for the update
    #service network restart

4) Set the hostname to the server
    #vi /etc/sysconfig/network
    HOSTNAME=rmugu

5) Create forward and reverse zone files
    #cd /var/named/chroot/var/named
    #cp localdomain.zone fwd.zone
    #cp named.local rev.zone

6) Change the group name of fwd.zone and rev.zone file as named
    #chgrp named fwd.zone rev.zone

7) Edit the file fwd.zone
    #vi fwd.zone

        $TTL    86400
        @               IN SOA  rmugu.mugu.in. root@mugu.in. (
                                                    42              ; serial (d. adams)
                                              3H              ; refresh
                                              15M             ; retry
                                                    1W              ; expiry
                                                1D )            ; minimum
                        IN NS           rmugu.mugu.in.
        rmugu           IN A            151.8.99.27
        www             IN CNAME        rmugu

8) Edit the file rev.zone
    #vi rev.zone

        $TTL    86400
        @       IN      SOA     rmugu.mugu.in. root@rmugu.mugu.in.  (
                                              1997022700 ; Serial
                                              28800      ; Refresh
                                              14400      ; Retry
                                              3600000    ; Expire
                                              86400 )    ; Minimum
                IN      NS      rmugu.mugu.in.
        27      IN      PTR     rmugu

9) Edit the file named.caching-nameserver.conf
    #vi /var/named/chroot/etc/named.caching-nameserver.conf

        Line 15: Add your syatem ip address in last (DNS server ip)
                 listen-on port 53 { 127.0.0.1; 151.8.99.27; };
        Line 16: comment this line we are using ip v4 only
         //      listen-on-v6 port 53 { ::1; };
        Line 22: comment this line also
         //      query-source-v6 port 53;
        Line 23: allow query from all the hosts
                allow-query     { localhost; any; };
        Line 32 & 33 : allow all clients
                match-clients      { localhost; any; };
                match-destinations { localhost; any; };

10) Edit the file named.rfc1912.zones
    #vi /var/named/chroot/etc/named.rfc1912.zones

         In last line add this contents,
        zone "mugu.in" IN {
                type master;
                file "fwd.zone";
                allow-update { none; };
        };
        zone "99.8.151.in-addr.arpa" IN {
                type master;
                file "rev.zone";
                allow-update { none; };
        };

11) Edit the resolv.conf file to identify the DNS server
    #vi /etc/resolv.conf
    nameserver 151.8.99.27

12) Restart the service
    #service named restart

13) To check whether DNS configured correctly or not
    #dig rmugu.mugu.in
    #www.mugu.in
    #dig -x 151.8.99.27

No comments: