DNS Setup in Linux

DNS  Setup in OEL 5.9 for RAC 11g R2 on VirtualBox:

We are configuring below DNS server for testing purpose and basically to fulfill the requirement of demo RAC 11gR2 installation on Virtualbox with OEL5.9 OS.

Before configuring we should know little about  DNS:

A DNS server is basically used to resolve the Hostname to IP address and IP address to Hostname ass well. In My case the entire hostname with domain name “rac1.db.com” is the Fully Qualified Domain name (FQDM) where “db.com” is the domain name.Subdomains are used to divide FQDM into zones.

What is Zone: Domain Name System (DNS) allows a DNS namespace to be divided up into zones, which store name information about one or more DNS domains. For each DNS domain name included in a zone, the zone becomes the authoritative source for information about that domain.A zone starts as a storage database for a single DNS domain name.

DNS Configuration:

1.Check whether DNS server rpms are installed or not (whereas It is good to include DNS server during installation of OEL 5.9:

First check dns service is running on your server or not and also Check following rpm shuold be installed:

[root@rac1 etc]# service named status

number of zones: 2

debug level: 0

xfers running: 0

xfers deferred: 0

soa queries in progress: 0

query logging is OFF

recursive clients: 0/1000

tcp clients: 0/100

server is up and running

named (pid  2857) is running…

[root@rac1 etc]# ps -ef|grep named

named     2857     1  0 18:03 ?        00:00:00 /usr/sbin/named -u named -t /var/named/chroot

root     29429 11617  0 18:48 pts/1    00:00:00 grep named

[root@rac1 etc]# rpm -qa|grep bind*

binutils-2.17.50.0.6-26.el5

bind-9.3.6-20.P1.el5_8.6

bind-utils-9.3.6-20.P1.el5_8.6

bind-chroot-9.3.6-20.P1.el5_8.6

ypbind-1.19-12.el5_6.1

bind-libs-9.3.6-20.P1.el5_8.6

[root@rac1 etc]# rpm -qa|grep cache*

libXfontcache-1.0.2-3.1

 

If services are not running and rpms are not installed then  install the RPMs.

2.Check  /etc/sysconfig/network file, your hostname should be added in this file:

My hostname= rac1.db.com

And IP=192.168.56.110

[root@rac1 etc]# more /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=rac1.db.com

NOZEROCONF=yes

3.Main configuration file for dns is “/var/named/chroot/etc/ named.conf”.

Check there will be a sample named file but you need to change it as per your environment, you can below file as example to make your own:

[root@rac1 etc]# vi named.conf

options{

        directory  "/var/named/";

};

 

zone "db.com" {

       type master;

       file "db.com.zone";

       allow-transfer {192.168.56.111;};

};

zone "56.168.192.in-addr.arpa" {

      type master;

      file "56.168.192.in-addr.arpa.zone";

};

Since we are using bind’s chroot features(chroot is a security feature in dns), so all important file will reside in /var/named/chroot directory.

4.I have created two zone file as mentioned in “/var/named/chroot/etc/ named.conf” file. One is “db.com.zone” for forward zone and “56.168.192.in-addr.arpa.zone” for reverse zone. You can use below both file content as an example:

cd /var/named/chroot/var/named

[root@rac1 named]# ls -ltr

total 32

drwxrwx— 2 named named 4096 Jul 27  2004 slaves

drwxrwx— 2 named named 4096 Aug 26  2004 data

-rw-r–r– 1 root  named  781 Aug 23 19:29 56.168.192.in-addr.arpa.zone

-rw-r–r– 1 root  named  593 Aug 23 19:33 db.com.zone

Vi  db.com.zone

$TTL    86400

@               IN SOA  db.com.       root (

                                        42              ; serial (d. adams)

                                        3H              ; refresh

                                        15M             ; retry

                                        1W              ; expiry

                                        1D )            ; minimum

 

@               IN NS           rac1.db.com.

@               IN NS           rac2.db.com.

rac1            IN A    192.168.56.110

rac2            IN A    192.168.56.111

rac1-vip            IN A    192.168.56.120

rac2-vip            IN A    192.168.56.121

rac-scan            IN A    192.168.56.150

rac-scan            IN A    192.168.56.151

rac-scan            IN A    192.168.56.152

rac1-priv            IN A    192.168.49.10

rac2-priv            IN A    192.168.49.11

 

vi  56.168.192.in-addr.arpa.zone

$TTL    86400

@       IN      SOA     db.com. root.rac1.db.com.  (

                                      1997022700 ; Serial

                                      28800      ; Refresh

                                      14400      ; Retry

                                      3600000    ; Expire

                                      86400 )    ; Minimum

        IN      NS      rac1.db.com.

110        IN      PTR     rac1.db.com.

111        IN      PTR     rac2.db.com.

120        IN      PTR     rac1-vip.db.com.

121        IN      PTR     rac2-vip.db.com.

150        IN      PTR     rac-scan.db.com.

151        IN      PTR     rac-scan.db.com.

152        IN      PTR     rac-scan.db.com.

10        IN      PTR     rac1-priv.db.com.

11        IN      PTR     rac2-priv.db.com.

 

5.Change group of both zone files:

chgrp named  db.com.zone

chgrp named  56.168.192.in-addr.arpa.zone

and should look like this:

[root@rac1 named]# ls -ltr

total 32

drwxrwx— 2 named named 4096 Jul 27  2004 slaves

drwxrwx— 2 named named 4096 Aug 26  2004 data

-rw-r–r– 1 root  named  781 Aug 23 19:29 56.168.192.in-addr.arpa.zone

-rw-r–r– 1 root  named  593 Aug 23 19:33 db.com.zone

 

6.Now start the name service and make in autorestart mode when server rebbots:

Chkconfig named on

Service named start

[root@rac1 named]# service named start

Starting named:                                            [  OK  ]

 

Service is started successfully, i.e. your dns configuration is successfully done.

And on other node of RAC, put following entry in resolv.conf

[root@rac1 named]# more /etc/resolv.conf

#; generated by /sbin/dhclient-script

domain db.com

nameserver  192.168.56.110

You can skip to the end and leave a response. Pinging is currently not allowed.

One Response to “DNS Setup in Linux”

  1. rishi says:

    Now Andriod App is available on Google play store. To download search OracleDbaHub

Leave a Reply