Friday, 3 April 2015

How to Configure the DNS Server for 11gR2 SCAN



From Oracle 11gR2, the Single Client Address Network (SCAN) has introduced and it is a requirement of networking setup to accommodate Oracle RAC network configuration. This note explains how to configure the DNS server for 11gR2 SCAN.  In most case this task is carried out by Network Administrator, but awareness these steps can be very useful for DBA in term of assisting NA in setting up properly DNS for RAC.
When installing Oracle Grid Infrastructure, there are 2 options:
1.      Configure GNS (Grid Naming Service) and let it handle name resolution
2.      Configure SCAN name with IP address defined in DNS
Oracle recommends using a separate DNS server, but for test environment only DNS server can be installed on one node of RAC servers.
Configuration
In my test environment, I am using a cluster node (racln1,192.168.1.110) as DNS server.
Domain is: localdomain
Node Name
Public IP
Private IP
VIP IP
racln1.localdomain
192.168.1.110
192.168.2.110
192.168.1.112
racln2.localdomain
192.168.1.111
192.168.2.111
192.168.1.113

1.      On racln1.localdomain install the DNS Server Package:
# yum install bind-libs bind bind-utils
Three packages must be installed on Linux for DNS Server:
  • bind (includes DNS server, named)
  • bind-utils (utilities for querying DNS servers about host information)
  • bind-libs (libraries used by the bind server and utils package)
You can obtain an account from the Yum Server which will install the package for you automatically. 
2.      On racln1.localdomain edit the "/etc/named.conf" file
Configure the "forwarder" under "options" in "/etc/named.conf "
We need to make sure the DNS is listening on the correct port for both the local and external IP address. This is done by the "listen-on" setting. This DNS server is only resolving the names of the servers on local network, so make sure that servers on external networks, like the internet, are resolved properly. To do this you add a "forwarder" entry to the end of the "options" section.

options {

        listen-on port 53 { 127.0.0.1; 192.168.1.110; };

        listen-on-v6 port 53 {::1;}

        directory /”var/named”;

        // Leave the rest of the config as it is.

        // Forwarder: Anything this DNS can't resolve gets forwarded to my ISPs DNS.

        forwarders { 192.168.1.1; };

        // End My Additions

};

3.      Configure Zone Entries for your domain in "/etc/named.conf "  
If you are using localdomain, it has been automatically configured and you can skip this step.
For other case we need to add the following lines to "/etc/named.conf"
. zone "abc.com" IN {
type master;
file "abc.com.zone";
allow-update { none; };
};
The "file" parameter specifies the name of the file in the "/var/named/" directory that contains the configuration for this zone.
4.      Configure reverse lookup in "/etc/named.conf "
Reverse lookup is used to let the client find out if the hostname matches to the related IP. In the case of a RAC installation, I want to create reverse lookups for my public (192.169.0.*) network, so I must add the following zone entry.

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

 5.      On dns1.testenv.com edit the config  files under /var/named
Because I am using localdomain so I have to edit /var/named/localdomain.zone, for other domains, for example abc.com, edit the file name: abc.com.zone and localdomain.zone. Add the line below to the end of this file (if the files don’t exist, create them):
racln1-vip IN A 192.168.1.112
racln2-vip IN A 192.168.1.113
rac-scan IN A 192.168.1.11
rac-scan IN A 192.168.1.12
rac-scan IN A 192.168.1.13

Put all the private IPs, VIP and SCAN VIPs in the DNS config file.  If you only want the DNS to resolve the scan-vip, only include the rac-scan with its three corresponding IP addresses in the file. 
Create/Edit the "/var/named/1.168.192.in-addr.arpa" file for reverse lookups as follows:

$ORIGIN 0.168.192.in-addr.arpa.
$TTL 1H
@       IN      SOA     racln1.localdomain.     root.racln1.localdomain. (      2
                                                3H
                                                1H
                                                1W
                                                1H )
0.168.192.in-addr.arpa.         IN NS      racln1.localdomain.
 
101     IN PTR  racln1.localdomain.
102     IN PTR  racln2.localdomain.
111     IN PTR  racln1-vip.localdomain.
112     IN PTR  racln2-vip.localdomain.
121     IN PTR  rac-scan.localdomain.
122     IN PTR  rac-scan.localdomain.
123     IN PTR  rac-scan.localdomain.

6.      Stop and start DNS Server to ensure it can be successfully restarted and make sure the DNS Server will be started automatically:

# service named stop
# service named start
# chkconfig named on

       7.      Edit file /etc/resolv.conf on all node to point to new DNS server

search localdomain #replace with your domain name

nameserver 192.168.1.110

8.      Change the hosts search order in  /etc/nsswitch.conf on all nodes
 
hosts: dns files nis

19.  At this point the configuration is complete, it is ready for test using reverse lookups  command.
# nslookup rac-scan.localdomain
Server: 192.168.1.110
Address: 192.168.1.110#53
Name: rac-scan.localdomain
 Address: 192.168.1.11
Name: rac-scan.testenv.com
Address: 192.168.1.12
Name: rac-scan.testenv.com
Address: 192.168.1.13