DNS Master & Slave in RHEL 5


1) Install DNS RPM on Master Server.

          # rpm -ivh bind-9.3.3-10el5.i386.rpm --->>> for core binaries.
          # rpm -ivh caching-nameserver-9.3.3-10el5.i386.rpm --->>> for security.
          # rpm -ivh bind-chroot-9.3.3-10el5.i386.rpm --->>> for an initial configuration.
          # rpm –ivh system-config-bind -à>> for configuration file.

2) Run the Commands.

          # service named configtest --->>>to check the errors in DNS.
          # service named start --->>> to start the service in current session.
          # service named restart --->>> to restart the service in current session.
          # chkconfig named on --->>> to start the service permanently.

         
3) Go to Master DNS Server and now edit /var/named/chroot/etc/named.conf with vim for DNS Configuration.

                   # listen on port 53    { 127.0.0.1; 192.168.0.254; };
                   # allow-query          { 127.0.0.1; 192.168.0.0/24; };
                   # allow-recursion      { 127.0.0.1; 192.168.0.0/24; };
                   # allow-transfer       { 127.0.0.1; 192.168.0.0/24; };
                   # forwarders           { 192.168.0.254; };
                   # forward only


                   zone "." IN {
                             type hint;
                             file "named.ca";
                   };

zone "example.com." IN {
                             type master;
                             file "forward.zone";
                             allow-update { none; };
                             notify yes;
                             also-notify { 192.168.0.253; };
                   };

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

          esc
          :wq

4) now copy localhost.zone to forward.zone and named.local to reverse.zone

    # cp –p /var/named/chroot/var/named/localhost.zone /var/named/chroot/var/named/forward.zone
    # cp –p /var.named/chroot/var/named/named.local /var/named/chroot/var/named/reverse.zone


5) Now edit /var/named/chroot/var/named/forward.zone with vim for forward lookup.
         
#vim /var/named/chroot/var/named/forward.zone
          $TTL    5
@               IN SOA           master.example.com.       root.master.example.com. (
                                                                             50                ; serial (d. adams)
                                                                             3                  ; refresh
                                                                             15M             ; retry
                                                                             1W              ; expiry
                                                                             1D )            ; minimum

@                 IN NS           master.example.com. -à>> Name Server.
mail1            IN MX           mail1.example.com. -à>> Mail Server.
master                   IN A             192.168.0.254 -à>> Name Server.
slave            IN A             192.168.0.253 -à>> Slave Server.
mail1            IN A             192.168.0.252 -à>> Mail Server.
www             IN A             192.168.0.251 -à>> Web Server.

esc
:wq

6) Now edit /var/named/chroot/var/named/reverse.zone with vim for reverse lookup.

$TTL    5
@                 IN      SOA              master.example.com.      root.master.example.com.  (
                                                                   1997022701   ; Serial
                                                                   3                  ; Refresh
                                                                   14400           ; Retry
                                                                   3600000        ; Expire
                                                                   86400 )         ; Minimum

@                 IN       NS               master.example.com.         -à>> Name Server.
254              IN       PTR              master.example.com.         -à>> Name Server.
253              IN       PTR              slave.example.com.            -à>> Slave Server.
252              IN       PTR              mail1.example.com.            -à>> Mail Server.
251              IN       PTR              www.example.com.            -à>> Web Server.

Esc
:wq


7) Run the commands.

          # chown named /var/named/chroot/etc/named.conf
          # chown named /var/named/chroot/var/named/forward.zone
          # chown named /var/named/chroot/var/named/reverse.zone

          # chmod 664 /var/named/chroot/etc/named.conf
          # chmod 664 /var/named/chroot/var/named/forward.zone
          # chmod 664 /var/named/chroot/var/named/reverse.zone

          # service named configtest --->>>to check the errors in DNS.
          # service named start --->>> to start the service in current session.
          # service named restart --->>> to restart the service in current session.

8) Install DNS RPM on Slave Server.

          # rpm -ivh bind-9.3.3-10el5.i386.rpm --->>> for core binaries.
          # rpm -ivh caching-nameserver-9.3.3-10el5.i386.rpm --->>> for security.
          # rpm -ivh bind-chroot-9.3.3-10el5.i386.rpm --->>> for an initial configuration.
          # rpm –ivh system-config-bind -à>> for configuration file.

9) Run the Commands.

          # service named configtest --->>>to check the errors in DNS.
          # service named start --->>> to start the service in current session.
          # service named restart --->>> to restart the service in current session.
          # chkconfig named on --->>> to start the service permanently.


10) Go to /var/named/chroot/

# cp -p /usr/share/system-config-bind/profiles/default/named.conf   /var/named/chroot/etc/named.conf
                   -p for preserve permessions.


11) Now edit /var/named/chroot/etc/named.conf with vim for DNS Configuration.

          # vim /var/named/chroot/etc/named.conf

                   zone "." IN {
                             type hint;
                             file "named.ca";
};

zone "linux.com." IN {
                             type slave;
                             file "forward1.zone";
                             masters { 192.168.0.254; };
};

zone "0.168.192.in-addr.arpa." IN {
                              type slave;
                             file "reverse1.zone";
                             masters { 192.168.0.254; };
};

          esc
          :wq

12) Run the commands.

          # chown named /var/named/chroot/etc/named.conf

          # chmod 664 /var/named/chroot/etc/named.conf


          # service named configtest --->>>to check the errors in DNS.
          # service named start --->>> to start the service in current session.
          # service named restart --->>> to restart the service in current session.


13) Now if we update anything in forward.zone and reverse.zone on Master DNS server we have to change the serial number in both files and restart the named server on master DNS Server and Slave DNS Server it will automatically create forwared1.zone and reverse1.zone defined in named.conf in Slave DNS Server. If the serial number is changed in Master DNS Server slave will replicate its DNS database but its manual. If we want automatic replication in Slave DNS Server we have to Configure DDNS (Dynamic Domain Name Server) on Master DNS Server. But after updating anything in master DNS Server we have to restart the service on both Master DNS Server and Slave DNS Server.


14) Run the Commands.

          # dig example.com
          # dig –t mx example.com --->>> for mail exchanger record.
          # dig –t AAAA example.com --->>> for Ipv6 rdata.
          # dig +trace example.com
          # dig –x 192.168.0.254 --->>> for reverse lookup.
          # dig –t soa example.com --->>> for authoritative nameservers for the domain.
          # dig -t axfr example.com. @192.168.0.254
                   Use this command from a slave to test permissions on the master.
                   Response is too big for UDP, so transfers use TCP

·         For any of the following queries, add a -v option to see output in zone file format
·         Trace: not available
·         Delegation: host -rt ns redhat.com
·         Force iterative: host -r redhat.com
·         Reverse lookup: host 209.132.177.50
·         MX lookup: host -t mx redhat.com
·         SOA lookup: host -t soa redhat.com
·         Zone transfer: host -t axfr redhat.com 192.168.0.254 or
·         host -t ixfr=serial example.com. 192.168.0.254

To know about the courses CLICK HERE..!!


Contact US CLICK HERE..!!

1 comment:

  1. Thanks for sharing this information You may also refer http://www.s4techno.com/linux-administration-training-online/ for more information…

    ReplyDelete