NaturalOracle DataGaurd tutorial Series Coming Soon!! Natural
For Any queries, please mail us at support@funoracleapps.com

Setup DNS server using BIND on OEL/Linux

No comments
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.

Pre-req:
Virtual Box is installed and a Machine is prepared. Below is the configuration of the machine.

Virtual DNS OS Configuration:
RAM: 1GB
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

BOOTPROTO=static
IPADDR=192.168.56.101
GATEWAY=255.255.255.0
NETMASK=255.255.255.0

Assign FQDN for server

 Add any fully qualified name which you want to give. 
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=himvirtualdns.lab

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
nameserver 192.168.56.101

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 { 127.0.0.1;192.168.56.101; };
            
            allow-query     { any; };
        

        type master;
        file "himvirtualdns.lab.zone";
        allow-update { none; };
};

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


Create Forward and Reverse zone files

Create forward and reverse lookup file


cd  /var/named
touch 56.168.192.in-addr.arpa himvirtualdns.lab.zone
Add below entry in respective files.
[root@himvirtualdns named]# cat himvirtualdns.lab.zone
$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            127.0.0.1
himvirtualdns   IN A    192.168.56.101

[root@himvirtualdns named]# cat 56.168.192.in-addr.arpa
$ORIGIN 56.168.192.in-addr.arpa.
$TTL 1H
@       IN      SOA     himvirtualdns.lab.     root.himvirtualdns.lab. (      2
                                                3H
                                                1H
                                                1W
                                                1H )
56.168.192.in-addr.arpa.         IN NS      himvirtualdns.lab.

101     IN PTR  himvirtualdns.lab.

 Change Ownership of the forward and reverse file.

cd /var/named
chown named:named 56.168.192.in-addr.arpa himvirtualdns.lab.zone

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
Server:             192.168.56.101
Address:          192.168.56.101#53

Name:  himvirtualdns.himvirtualdns.lab
Address: 192.168.56.101

[root@himvirtualdns named]# nslookup 192.168.56.101
Server:             192.168.56.101
Address:          192.168.56.101#53

101.56.168.192.in-addr.arpa      name = himvirtualdns.lab.


No comments :

Post a Comment