Thursday, 27 February 2014

Setups to configure DNS in rhel6

step 1: check the server details

 #dig desktop1.example.com

step 2: install server packages

[root@desktop29 ~]# yum install bind* -y
Loaded plugins: product-id, refresh-packagekit, security, subscription-
              : manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Package 32:bind-libs-9.8.2-0.10.rc1.el6.x86_64 already installed and latest version
Package 32:bind-utils-9.8.2-0.10.rc1.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.10.rc1.el6 will be installed
---> Package bind-chroot.x86_64 32:9.8.2-0.10.rc1.el6 will be installed
---> Package bind-devel.x86_64 32:9.8.2-0.10.rc1.el6 will be installed
---> Package bind-dyndb-ldap.x86_64 0:1.1.0-0.9.b1.el6 will be installed
---> Package bind-sdb.x86_64 32:9.8.2-0.10.rc1.el6 will be installed
--> Processing Dependency: libpq.so.5()(64bit) for package: 32:bind-sdb-9.8.2-0.10.rc1.el6.x86_64
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.4.11-1.el6_2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================
 Package           Arch     Version                   Repository  Size
=======================================================================
Installing:
 bind              x86_64   32:9.8.2-0.10.rc1.el6     base       4.0 M
 bind-chroot       x86_64   32:9.8.2-0.10.rc1.el6     base        70 k
 bind-devel        x86_64   32:9.8.2-0.10.rc1.el6     optional   375 k
 bind-dyndb-ldap   x86_64   1.1.0-0.9.b1.el6          base        63 k
 bind-sdb          x86_64   32:9.8.2-0.10.rc1.el6     optional   303 k
Installing for dependencies:
 postgresql-libs   x86_64   8.4.11-1.el6_2            base       198 k

Transaction Summary
=======================================================================
Install       6 Package(s)

Total download size: 4.9 M
Installed size: 9.9 M
Downloading Packages:
(1/6): bind-9.8.2-0.10.rc1.el6.x86_64.rpm       | 4.0 MB     00:00    
(2/6): bind-chroot-9.8.2-0.10.rc1.el6.x86_64.rp |  70 kB     00:00    
(3/6): bind-devel-9.8.2-0.10.rc1.el6.x86_64.rpm | 375 kB     00:00    
(4/6): bind-dyndb-ldap-1.1.0-0.9.b1.el6.x86_64. |  63 kB     00:00    
(5/6): bind-sdb-9.8.2-0.10.rc1.el6.x86_64.rpm   | 303 kB     00:00    
(6/6): postgresql-libs-8.4.11-1.el6_2.x86_64.rp | 198 kB     00:00    
-----------------------------------------------------------------------
Total                                   46 MB/s | 4.9 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-9.8.2-0.10.rc1.el6.x86_64                   1/6
  Installing : postgresql-libs-8.4.11-1.el6_2.x86_64               2/6
  Installing : 32:bind-sdb-9.8.2-0.10.rc1.el6.x86_64               3/6
  Installing : 32:bind-chroot-9.8.2-0.10.rc1.el6.x86_64            4/6
  Installing : bind-dyndb-ldap-1.1.0-0.9.b1.el6.x86_64             5/6
  Installing : 32:bind-devel-9.8.2-0.10.rc1.el6.x86_64             6/6
Installed products updated.
  Verifying  : 32:bind-sdb-9.8.2-0.10.rc1.el6.x86_64               1/6
  Verifying  : postgresql-libs-8.4.11-1.el6_2.x86_64               2/6
  Verifying  : 32:bind-devel-9.8.2-0.10.rc1.el6.x86_64             3/6
  Verifying  : 32:bind-chroot-9.8.2-0.10.rc1.el6.x86_64            4/6
  Verifying  : bind-dyndb-ldap-1.1.0-0.9.b1.el6.x86_64             5/6
  Verifying  : 32:bind-9.8.2-0.10.rc1.el6.x86_64                   6/6

Installed:
  bind.x86_64 32:9.8.2-0.10.rc1.el6                                  
  bind-chroot.x86_64 32:9.8.2-0.10.rc1.el6                            
  bind-devel.x86_64 32:9.8.2-0.10.rc1.el6                            
  bind-dyndb-ldap.x86_64 0:1.1.0-0.9.b1.el6                          
  bind-sdb.x86_64 32:9.8.2-0.10.rc1.el6                              

Dependency Installed:
  postgresql-libs.x86_64 0:8.4.11-1.el6_2                            

Complete!


step 3: restart the services
# service named restart; chkconfig named on
Stopping named:                                            [  OK  ]
Generating /etc/rndc.key:                                  [  OK  ]

Starting named:                                            [  OK  ]

[root@desktop29 ~]# vim /etc/named.conf
add the ip address and port no
//
// 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; 192.168.1.29; };
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; 192.168.0.0/24; };
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";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

[root@desktop29 ~]# vim /etc/named.rfc1912.zones
You have new mail in /var/spool/mail/root
add the content highlighted in red
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package 
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
// 
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};

zone "1.0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};

zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
###################
zone "cracker.org" IN {
type master;
file "forward.zone";
allow-update { none; };
};

zone "0.168.192.in-addr.arpa" IN {
type master;
file "reverse.zone";
allow-update { none; };
};

step 5: copy named.localhost to forward.zone and named.loopback to reverse.zone
# cd /var/named/
# cp -p named.localhost forward.zone
# cp -p named.loopback reverse.zone

# named-checkzone flz forward.zone
zone flz/IN: loaded serial 0
OK

# named-checkzone rlz reverse.zone
zone rlz/IN: loaded serial 0
OK

# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]


No comments:

Post a Comment