Home
 | 
Miscellaneous
 | 
How to setup a DNS server?
 | 
How to setup a DNS server?
 
Overview
Recent Article
All Archives
Topics
Comments 
Last modified: January 2017
»»
I'm not an expert in the DNS server configuration, but in this article, I will create a DNS server with bare minimum configuration. The idea is to build a DNS server to resolve Single Client Access Name or SCAN which is a new feature introduced in 11g R2 RAC.
SCAN enables the clients to use a single hostname to access oracle databases running in the cluster. Clients using SCAN do not need to change their TNS configuration if you add or remove nodes in the cluster. So, let's get started.

OS: RedHat Enterprise Linux 5.4 x64
Hostname: rhel54.shannura.com
IP: 172.168.190.200
SCAN name: shannuracluster-scan
1. Login as root
2. Install 'bind' package. I have already installed it.
$
[root@rhel ~]# rpm -q bind-chroot
bind-chroot-9.3.6-4.Pl.el5
3. Setting up the configuration file

/var/named/chroot/etc/named.conf
$
[root@rhel54 /]# cat /var/named/chroot/etc/named.conf
options
{
     directory "/var/named";
     listen-on port 53 {any;};
};
zone "shannura.com"
{
     type master;
     file "shannura.com.fwd.zone";
};
zone "localhost"
{
     type master;
     file "localhost.fwd.zone";
};
zone "190.168.172.in-addr.arpa"
{
     type master;
     file "172.168.190.rev.zone";
};
zone "0.0.127.in-addr.arpa"
{
     type master;
     file "localhost.rev.zone";
};
4. Create the following zone configuration files

/var/named/chroot/var/named/shannura.com.fwd.zone
/var/named/chroot/var/named/172.168.190.rev.zone
/var/named/chroot/var/named/localhost.fwd.zone
/var/named/chroot/var/named/localhost.rev.zone
$
[root@rhel54 /]# cat /var/named/chroot/var/named/shannura.com.fwd.zone
$TTL 1D
@                       IN         SOA             rhel54.shannura.com.    root.localhost (
                                   201710031200    ;       serial
                                   8H              ;       refresh
                                   4H              ;       retry
                                   1W              ;       expiry
                                   1D )            ;       minimum
@                       IN         NS              rhel54.shannura.com.
localhost               IN         A               127.0.0.1
rhel54                  IN         A               172.168.190.200
ol-alpha                IN         A               172.168.190.101
ol-beta                 IN         A               172.168.190.102
ol-gamma                IN         A               172.168.190.103
ol-alpha-dr             IN         A               172.168.190.110
ol-alpha-vip            IN         A               172.168.190.201
ol-beta-vip             IN         A               172.168.190.202
ol-gamma-vip            IN         A               172.168.190.203
shannuracluster-scan     IN        A               172.168.190.211
                        IN         A               172.168.190.212
                        IN         A               172.168.190.213
$
[root@rhel54 /]# cat /var/named/chroot/var/named/172.168.190.rev.zone
$TTL 1D
@                       IN         SOA             rhel54.shannura.com.    root.localhost.  (
                                                   201710031200     ;    serial
                                                   8H               ;    refresh
                                                   4H               ;    retry
                                                   1W               ;    expiry
                                                   1D )             ;    minimum
@                       IN         NS              rhel54.shannura.com.
200                     IN         PTR             rhel54.shannura.com.
101                     IN         PTR             ol-alpha.shannura.com.
102                     IN         PTR             ol-beta.shannura.com.
103                     IN         PTR             ol-gamma.shannura.com.
110                     IN         PTR             ol-alpha-dr.shannura.com.
201                     IN         PTR             ol-alpha-vip.shannura.com.
202                     IN         PTR             ol-beta-vip.shannura.com.
203                     IN         PTR             ol-gamma-vip.shannura.com.
211                     IN         PTR             shannuracluster-scan.shannura.com.
212                     IN         PTR             shannuracluster-scan.shannura.com.
213                     IN         PTR             shannuracluster-scan.shannura.com.
$
[root@rhel54 /]# cat /var/named/chroot/var/named/localhost.fwd.zone
$TTL 1D
@                       IN         SOA             rhel54.shannura.com.    root.localhost (
                                   201710031200    ;       serial
                                   8H              ;       refresh
                                   4H              ;       retry
                                   1W              ;       expiry
                                   1D )            ;       minimum
                        IN         NS              @
                        IN         A               127.0.0.1
$
[root@rhel54 /]# cat  /var/named/chroot/var/named/localhost.rev.zone
$TTL 1D
@                       IN         SOA             rhel54.shannura.com.    root.localhost.  (
                                                   201710031200     ;    serial
                                                   8H               ;    refresh
                                                   4H               ;    retry
                                                   1W               ;    expiry
                                                   1D )             ;    minimum
@                       IN         NS              localhost.
1                       IN         PTR             localhost.
5. /etc/resolv.conf
$
[root@rhel54 /]# cat /etc/resolv.conf
nameserver 172.168.190.200
domain shannura.com
search shannura.com
options timeout: 3
options timeout: 3
Ensure similar entries are added into /etc/resolv.conf in all the cluster nodes. What this tells is that forward any connection request for shannura.com to DNS server running at IP address 172.168.190.200 (rhel54.shannura.com).
$
[root@rhel54 /]# chkconfig iptables off
[root@rhel54 /]# service iptables stop
[root@rhel54 /]# service named start
[root@rhel54 /]# service named status
number of zones: 4
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  1533) is running...
6. SCAN name resolution (nslookup)
$
[root@rhel54 /]# nslookup shannuracluster-scan
Server:         172.168.190.200
Address:        172.168.190.200#53

Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.212
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.213
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.211

[root@rhel54 /]# nslookup shannuracluster-scan
Server:         172.168.190.200
Address:        172.168.190.200#53

Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.211
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.212
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.213

[root@rhel54 /]# nslookup shannuracluster-scan
Server:         172.168.190.200
Address:        172.168.190.200#53

Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.213
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.211
Name:   shannuracluster-scan.shannura.com
Address: 172.168.190.212
Notice that each time when you do the nslookup, the DNS server serves a different IPs from the three available IPs in a cyclic fashion for the same hostname (shannuracluster-scan).
Please write your comment if this article was useful.

Shannura

/
You might want to read this: