Sunday, 8 January 2012

BIND CONFIGURATION IN RHEL5

------------------------------------
yum install bind* caching-nameserver
chkconfig named --levels 35 on
cd /var/named/chroot/etc/
vim named.conf
--------------
chown root.named named.conf
-------------------------------------
cd /var/named/chroot/var/named/
 cp -p localhost.zone anjan.for
cp -p named.local anjan.rev
 -------------------------------------
service named start

vi named.conf
  //
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver 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.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { 127.0.0.1; 10.138.1.2; };
        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";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { localhost; 10.138.1.0/24; };
        allow-query-cache { localhost; 10.138.1.0/24; };
};
// 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
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "anjan.local" IN {
        type master;
        file "anjan.for";
        allow-update { none; };
};

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


Forward lookup zone
 cp localhost.zone redhat.for
 vi anjan.for
  $TTL    86400

@               IN SOA dns.anjan.local. root.dns.anjan.local. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           dns.anjan.local.
dns             IN A            192.168.0.1
 Reverse lookup zone
vi anjan.rev  

$TTL    86400
@       IN      SOA     dns.anjan.local. root.dns.anjan.local. (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      dns.anjan.local.
1       IN      PTR     dns.anjan.local.
 #Slave named config  options {
 directory "/var/named";
 dump-file "/var/named/data/cache_dump.db";
 statistics-file "/var/named/data/named_stats.txt";
 };
 zone "google.com." IN {
 type slave;
 masters { 192.168.0.2; };
 file "slaves/google.for";
 };
 zone "yahoo.com." IN {
 type slave;
 masters { 192.168.0.5; };
 file "slaves/yahoo.for";
 };
 zone "redhat.com." IN {
 type slave;
 masters { 192.168.0.7; };
 file "slaves/redhat.for";
 };
 zone "0.168.192.in-addr.arpa." IN {
 type slave;
 masters { 192.168.0.2; 192.168.0.5; 192.168.0.7; };
 file "slaves/google.rev";
 };
 include "/etc/rndc.key";
 service named restart
 It will automatically creates the forward and reverse lookup zones in dir slaves

No comments:

Post a Comment