In this post, I am going to share the steps for setup of DNS server. It will be used in my upcoming posts for RAC 12c setup.

Virtual Box is installed and a Machine is prepared. Below is the configuration of the machine.

Virtual DNS OS Configuration:
HardDisk Size : 12 GB

Operating System: Oracle Enterprise Linux

The installation of the Server would be a basic installation with Option selected as Software Development Workstation to get a GUI. Once the OS installation is done you can optionally install Guest Addition as it helps for easy mouse movements and sharing a file from host system to this guest virtual system.

Steps to configure DNS Server.

  • ·         Install DNS Package
  • ·         Assign static IP to the server
  • ·         Assign FQDN(Fully Qualified Domain Name) for server
  • ·         Configure /etc/hosts
  • ·         Configure /etc/resolv.conf        
  • ·         Configure /etc/named.conf
  • ·         Configure Forward and reverse zone
  • ·         Change the group ownership  of Forward and reverse zone file
  • ·         Restart DNS Server.
  • ·         Change permission of the resolv.conf

Installation of the DNS server (BIND)

From the command line issue the following command.
# yum install bind-libs bind bind-utils

Assign static IP

cd /etc/sysconfig/network-scripts
I am using my adapter 2 so I have changed the entry in eth1.
Change ifcfg-eth1 file and add below entry

cd /etc/sysconfig/network-scripts
vi ifcfg-eth1


Assign FQDN for server

 Add any fully qualified name which you want to give. 
vi /etc/sysconfig/network

Change /etc/resolv.conf

Change /etc/resolv.conf and also change it permission so that it will be not overwritten once server is restarted.
This resolv.conf entry has to be made on all the client systems as well.

[root@himvirtualdns network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
search himvirtualdns.lab

Permission change
chattr +i resolv.conf

Change /etc/named.conf  File

Edit the contents of the "/etc/named.conf" file. Depending on the setup you require, you may need to make lots of changes, or none at all. For my home network I use "himvirtualdns.lab" as my domain and the IP range "192.168.56.*", so this is what I will show here.
We are adding both forward and reserve lookup
I will show lines which needs to be updated and added

            listen-on port 53 {;; };
            allow-query     { any; };

        type master;
        file "";
        allow-update { none; };

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

Create Forward and Reverse zone files

Create forward and reverse lookup file

cd  /var/named
Add below entry in respective files.
[root@himvirtualdns named]# cat
$TTL    86400
@               IN SOA  localhost root.localhost (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A  
himvirtualdns   IN A

[root@himvirtualdns named]# cat
@       IN      SOA     himvirtualdns.lab.     root.himvirtualdns.lab. (      2
                                                1H )         IN NS      himvirtualdns.lab.

101     IN PTR  himvirtualdns.lab.

 Change Ownership of the forward and reverse file.

cd /var/named
chown named:named

To Make sure Bind is started every time server is restarted.

chkconfig named on

Restart named

service named restart

Check if DNS is working fine

[root@himvirtualdns named]# nslookup himvirtualdns

Name:  himvirtualdns.himvirtualdns.lab

[root@himvirtualdns named]# nslookup
Address:      name = himvirtualdns.lab.