LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > deep27ak
User Name
Password

Notices



Rating: 2 votes, 2.50 average.

DNS configuration in RHEL (Forward and reverse zone)

Posted 11-10-2011 at 05:13 AM by deep27ak
Updated 08-18-2012 at 05:03 AM by deep27ak

For more Linux based tutorials My BLOG

Few things you need to check before starting with configuration:

For explanation I am using 192.168.0.100 (you need to give your machine's IP instead) and all other conventions will vary as per your requirements. So make sure to change them.

Code:
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
IPAddr=192.168.0.100 (will vary accordingly)
Code:
#vi /etc/resolv.conf
nameserver 192.168.0.100
Code:
#vi /etc/hosts
192.168.0.100 server.example.com    server (make sure this line is present)
Code:

#vi /etc/sysconfig/network
HOSTNAME=server.example.com
As for the configuration

Code:
#yum -y install bind*

#yum -y install caching-nameserver
Once you install bind package by default all the packages gets stored inside
Code:
/usr/share/doc/bind-9.3.3/sample/
So copy all the files to
Code:
/var/named/chroot/
Code:
#cp /usr/share/doc/bind-9.3.3/sample/etc/*  /var/named/chroot/etc/
#cp /usr/share/doc/bind-9.3.3/sample/var/named/*  /var/named/chroot/var/named/
#cp /usr/share/doc/bind-9.3.3/sample/var/named/slaves/*  /var/named/chroot/var/named/slaves/

#cp /etc/named.caching-nameserver  /var/named/chroot/etc/named.conf

#cd /var/named/chroot/etc/
Code:
#vi named.conf
(check the entries in the red lines)
options {
        listen-on port 53 { 127.0.0.1; 192.168.0.100; };
        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;};
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { localhost; 192.168.0.0/24; };
        match-destinations { localhost; 192.168.0.0/24; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
Mention the entries of zone in this file as follows:

Code:
#vi named.rfc1912.zones
zone "example.com" IN {
        type master;
        file "example.com.zone";
        allow-update {none;};
};

zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.0.zone";
        allow-update{none;};
configuration of zone files:

Code:
#cd /var/named/chroot/var/named/
#cp named.local 192.168.0.zone
#cp localhost.zone  example.com.zone
Code:
#vi example.com.zone
$TTL    86400
@               IN SOA  server.example.com.       root.example.com. (
                                        52              ; serial
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server.example.com.
                IN MX           10 server.example.com.

server          IN A            192.168.0.100
www             IN A            192.168.0.100
Code:
#vi 192.168.0.zone
$TTL    86400
@       IN      SOA     server.example.com.    root.server.example.com.  (
                                      1997022703 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      server.example.com.
100     IN      PTR     server.example.com.
Code:
#service named restart
check your DNS
Code:
#dig -x 192.168.0.100
; <<>> DiG 9.3.3rc2 <<>> -x 192.168.0.100
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45439
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;100.0.168.192.in-addr.arpa.    IN      PTR

;; ANSWER SECTION:
100.0.168.192.in-addr.arpa. 86400 IN    PTR     server.deepsoft.com.

;; AUTHORITY SECTION:
0.168.192.in-addr.arpa. 86400   IN      NS      server.deepsoft.com.

;; ADDITIONAL SECTION:
server.deepsoft.com.    86400   IN      A       192.168.0.100

;; Query time: 1 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Thu Nov 10 07:55:59 2011
;; MSG SIZE  rcvd: 107
Code:
#nslookup server.deepsoft.com
Server:         192.168.0.100
Address:        192.168.0.100#53

Name:   server.example.com
Address: 192.168.0.100
Posted in Uncategorized
Views 2216 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 09:39 AM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration