Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

GNS configuration for Oracle 11gR2 in DNS using DHCP

GNS configuration for Oracle 11gR2 in DNS using DHCP

Oracle 11gR2 introduces a new concept of a Single Client Access Name (SCAN). Prior to Oracle 11gR2 adding or removing nodes from the cluster required changes in the tnsnames.ora for the node VIP addresses. With SCAN Oracle eliminated the need to change tnsnames.ora entries. SCAN is required for Oracle 11gR2 Grid Infrastructure installation and OUI cannot complete install unless SCAN is defined since the SCAN concept is an essential part during the creation of Oracle RAC 11gR2 database.

SCAN can be defined in following ways:

  • In the DNS – a single name that resolves to three IP addresses must be created in DNS. The IP should not be assigned to a NIC as the Oracle Grid Infrastructure will
  • Using GNS – instead of listing SCAN static addresses in DNS a sub-domain must be created in DNS for GNS to run that is, we will create a static virtual IP address in DNS for GNS. The node VIP and the SCAN VIP are obtained from the DHCP server when using GNS.
  • In /etc/hosts on each node of the cluster – a single IP for the whole cluster. Helps bypass the OUI installer limitation of DNS defined SCAN.

Here in the article we will look at how to configure a GNS entry in the DNS resolvable to a GNS VIP using Oracle Enterprise Linux (OEL) 5.5. For grid.gj.com a “delegation” is made, so that every request to a machine in the domain .grid.gj.com is delegated to the GNS. (with the GNS VIP).The BIND DNS server is used in the exercise. We have a RAC cluster on nodes raclinux1, raclinux2 and raclinux3. The public addresses of the cluster nodes, the GNS VIP address and DNS server IP will be added to a new domain with reverse lookup enabled. The setup is performed on a separate DNS server dnsoel55 acting as NS. The DNS will contain the following mappings.

raclinux1     192.168.20.10

raclinux2     192.168.20.20

raclinux3     192.168.20.30

dnsoel55     192.168.20.50

gns.grid.gj.com        192.168.20.52

Note: the cluster node VIPs and SCANs are obtained via DHCP.

Install BIND – Make sure the following rpms are installed

[root@dnsoel55 named]# rpm -qa | grep bind

bind-9.3.6-4.P1.el5_4.2

bind-libs-9.3.6-4.P1.el5_4.2

system-config-bind-4.0.3-4.0.1.el5

bind-chroot-9.3.6-4.P1.el5_4.2

bind-utils-9.3.6-4.P1.el5_4.2

[root@dnsoel55 named]#

Install DHCP –Make sure the following rpms are installed

[root@dnsoel55 named]# rpm -qa | grep dhcp-3

dhcp-3.0.5-23.el5

[root@dnsoel55 named]#

Make sure DNS information is set while configuring Network Devices.


Configure BIND

We will create a new custom zone gj.com and will list the public nodes of the cluster in the domain in order to map a hostname to an address. We will create a new custom zone grid.gj.com for the GNS virtual IP (VIP). We will add a reverse DNS lookup for the entries as well by adding a zone “20.168.192.in-addr.arpa” in order to identify a hostname by the address. In the /etc/named.conf file we will add the following entries.

zone “20.168.192.in-addr.arpa” IN {

type master;

file “gj1.com.reverse”;

allow-update { none; };

};

zone “gj.com.” IN {

type master;

file “gj1.zone”;

allow-update { none; };

};

zone “grid.gj.com.” IN {
type forward;
forward only;
forwarders { 192.168.20.52 ;};
};

The custom zone, for the public IP, definition is in the gj.zone file as shown in the Appendix. The reverse lookup is in the gj.com.reverse file as shown in the Appendix. The custom zone, for GNS VIP, definition is in the grid.gj.zone file as shown in the Appendix. Both zone files are in /var/named directory. For each entry that is added in the /etc/named.conf make sure the respective zone files are updated.

Configure DHCP

For GNS resolution we will configure DHCL by editing the /etc/dhcpd.conf file and specifying the domain, IP range for the nodes VIP, SCANS etc. In this example the gj.com domin is used and an IP range 192.168.20.100 to 192.168.20.120 is provided.


[root@dnsoel55 named]# cat /etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

subnet 192.168.20.0 netmask 255.255.255.0 {

# --- default gateway

option routers                  192.168.30.254;

option subnet-mask              255.255.255.0;

#       option nis-domain               "gj.com";

option domain-name              "gj.com";

option domain-name-servers      192.168.30.50;

option time-offset              -18000; # Eastern Standard Time

#       option ntp-servers              192.168.1.1;

#       option netbios-name-servers     192.168.1.1;

# --- Selects point-to-point node (default is hybrid). Don't change this unless

# -- you understand Netbios very well

#       option netbios-node-type 2;

range 192.168.20.100 192.168.20.120;

default-lease-time 21600;

max-lease-time 43200;

}

[root@dnsoel55 named]#

Edit the file /etc/resolv.conf to specify the IP of the DNS server and the domain name on each node. The Appendix contains a sample.

Edit /etc/nsswitch.conf to specify lookup order.

hosts: dns files

Start/Stop/Restart the named

[root@dnsoel55 named]# service named stop

Stopping named: [ OK ]

[root@dnsoel55 named]# service named start

Starting named: [ OK ]

[root@dnsoel55 named]#

[root@dnsoel55 named]# service named restart

Stopping named: [ OK ]

Starting named: [ OK ]

[root@dnsoel55 named]#

To start up the named service on boot execute the following command.

[root@dnsoel55 named]# chkconfig named on

[root@dnsoel55 named]#

Start/Stop/Restart the dhcpd

[root@dnsoel55 named]# service dhcpd start

[root@dnsoel55 named]# service dhcpd stop

Shutting down dhcpd: [ OK ]

[root@dnsoel55 named]# service dhcpd restart

Starting dhcpd: [ OK ]

[root@dnsoel55 named]# service dhcpd restart

Shutting down dhcpd: [ OK ]

Starting dhcpd: [ OK ]

[root@dnsoel55 named]#

Optionally use system-config-bind to look at the setup

The gj.com zone appears as show below.


The zone grid.gj.com appears as below


The zone 20.168.192.in-addr.arpa for the reverse lookup appears as show below.


Disable iptable service for the external hosts to be able to connect to DNS server.

[root@dnsoel55 named]# service iptables stop

Flushing firewall rules: [ OK ]

Setting chains to policy ACCEPT: nat filter [ OK ]

Unloading iptables modules: [ OK ]

Test

[root@dnsoel55 named]# nslookup raclinux1
Server:         192.168.30.50
Address:        192.168.30.50#53

Name:   raclinux1.gj.com
Address: 192.168.20.10

[root@dnsoel55 named]# nslookup 192.168.20.10
Server:         192.168.30.50
Address:        192.168.30.50#53

10.20.168.192.in-addr.arpa      name = raclinux1.gj.com.

[root@dnsoel55 named]# nslookup raclinux2
Server:         192.168.30.50
Address:        192.168.30.50#53

Name:   raclinux2.gj.com
Address: 192.168.20.20

[root@dnsoel55 named]# nslookup 192.168.20.20
Server:         192.168.30.50
Address:        192.168.30.50#53

20.20.168.192.in-addr.arpa      name = raclinux2.gj.com.

[root@dnsoel55 named]# nslookup dnsoel55
Server:         192.168.30.50
Address:        192.168.30.50#53

Name:   dnsoel55.gj.com
Address: 192.168.20.50

[root@dnsoel55 named]# nslookup 192.168.20.50
Server:         192.168.30.50
Address:        192.168.30.50#53

50.20.168.192.in-addr.arpa      name = dnsoel55.gj.com.
[root@dnsoel55 named]# nslookup gns.grid.gj.com
Server:         192.168.30.50
Address:        192.168.30.50#53

Name:   gns.grid.gj.com
Address: 192.168.20.52
[root@dnsoel55 named]# nslookup 192.168.20.52
Server:         192.168.30.50
Address:        192.168.30.50#53

52.20.168.192.in-addr.arpa      name = gns.grid.gj.com.

[root@dnsoel55 named]#

Summary

We looked at the rpms required to install BIND and DHCP on OEL. We created a custom and reverse lookup zone for the cluster public nodes and for the GNS VIP. The configuration files required for DNS setup were described. We tested the forward and reverse DNS resolution. The above DNS setup will ensure that we have GNS VIP for the Oracle 11gR2 Grid Infrastructure installation.

After the Oracle GI installation the nslookup output will be something like:

[root@dnsoel55 named]# nslookup scan.grid.gj.com

Server: 192.168.20.50

Address: 192.168.20.50#53

Non-authoritative answer:

Name: scan.grid.gj.com

Address: 192.168.20.107

Name: scan.grid.gj.com

Address: 192.168.20.108

Name: scan.grid.gj.com

Address: 192.168.20.109

[root@dnsoel55 named]#

Appendix:


[root@dnsoel55 etc]# cat named.conf

// Enterprise Linux BIND Configuration Tool

//

// Default initial "Caching Only" name server configuration

//

options {

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below.  Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

zone "20.168.192.in-addr.arpa" IN {

type master;

file "gj1.com.reverse";

allow-update { none; };

};

zone "30.168.192.in-addr.arpa" IN {

type master;

file "gj.reverse";

allow-update { none; };

};

zone "gj.com." IN {

type master;

file "gj1.zone";

allow-update { none; };

};

zone "grid.gj.com." IN {

type forward;
forward only;
forwarders { 192.168.2.61 ;}
};

zone "." IN {

type hint;

file "named.root";

};

zone "localdomain." IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost." IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa." IN {

type master;

file "named.local";

allow-update { none; };

};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." IN {

type master;

file "named.ip6.local";

allow-update { none; };

};

zone "255.in-addr.arpa." IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa." IN {

type master;

file "named.zero";

allow-update { none; };

};

include "/etc/rndc.key";

[root@dnsoel55 etc]#

[root@dnsoel55 named]# cat gj1.com.reverse

$ORIGIN 20.168.192.in-addr.arpa.

$TTL 1H

@       IN      SOA     dnsoel55.gj.com.     root.dnsoel55.gj.com. (      2

3H

1H

1W

1H )

20.168.192.in-addr.arpa.         IN NS      dnsoel55.gj.com.

IN NS      dnsoel55.gj.com.

10              IN PTR  raclinux1.gj.com.

20              IN PTR  raclinux2.gj.com.

30              IN PTR  raclinux3.gj.com.

50              IN PTR  dnsoel55.gj.com.

52              IN PTR  gns.grid.gj.com.

[root@dnsoel55 named]# cat gj1.zone

$TTL    86400

@               IN SOA  dnsoel55 root (

43              ; serial (d. adams)

3H              ; refresh

15M             ; retry

1W              ; expiry

1D )            ; minimum

IN NS           dnsoel55

raclinux1           IN A        192.168.20.10

raclinux2           IN A        192.168.20.20

raclinux3           IN A        192.168.20.30

dnsoel55        IN A            192.168.20.50
gns.grid.gj.com.        IN      A        192.168.20.52

[root@dnsoel55 named]# cat grid.gj.zone

$TTL    86400

@               IN SOA  dnsoel55 root (

43              ; serial (d. adams)

3H              ; refresh

15M             ; retry

1W              ; expiry

1D )            ; minimum

IN NS           dnsoel55

IN      NS     gns.grid.gj.com.

IN      NS     dnsoel55.gj.com.

gns           IN      A      192.168.20.52

dnsoel55        IN A            192.168.20.50

[root@dnsoel55 named]#

[root@dnsoel55 named]# cat /etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

subnet 192.168.20.0 netmask 255.255.255.0 {

# --- default gateway

option routers                  192.168.30.254;

option subnet-mask              255.255.255.0;

#       option nis-domain               "gj.com";

option domain-name              "gj.com";

option domain-name-servers      192.168.30.50;

option time-offset              -18000; # Eastern Standard Time

#       option ntp-servers              192.168.1.1;

#       option netbios-name-servers     192.168.1.1;

# --- Selects point-to-point node (default is hybrid). Don't change this unless

# -- you understand Netbios very well

#       option netbios-node-type 2;

range 192.168.20.100 192.168.20.120;

default-lease-time 21600;

max-lease-time 43200;

}

[root@dnsoel55 named]#

[root@dnsoel55 named]# cat /etc/resolv.conf

options attempts: 2

options timeout: 1

options attempts: 2

; generated by /sbin/dhclient-script

search gj.com

nameserver 192.168.30.50

[root@dnsoel55 named]#

[root@dnsoel55 named]# cat /etc/nsswitch.conf

#

# /etc/nsswitch.conf

#

# An example Name Service Switch config file. This file should be

# sorted with the most-used services at the beginning.

#

# The entry '[NOTFOUND=return]' means that the search for an

# entry should stop if the search in the previous entry turned

# up nothing. Note that if the search failed due to some other reason

# (like no NIS server responding) then the search continues with the

# next entry.

#

# Legal entries are:

#

#       nisplus or nis+         Use NIS+ (NIS version 3)

#       nis or yp               Use NIS (NIS version 2), also called YP

#       dns                     Use DNS (Domain Name Service)

#       files                   Use the local files

#       db                      Use the local database (.db) files

#       compat                  Use NIS on compat mode

#       hesiod                  Use Hesiod for user lookups

#       [NOTFOUND=return]       Stop searching if not found so far

#

# To use db, put the "db" in front of "files" for entries you want to be

# looked up first in the databases

#

# Example:

#passwd:    db files nisplus nis

#shadow:    db files nisplus nis

#group:     db files nisplus nis

passwd:     files

shadow:     files

group:      files

#hosts:     db files nisplus nis dns

hosts:      dns files

# Example - obey only what nisplus tells us...

#services:   nisplus [NOTFOUND=return] files

#networks:   nisplus [NOTFOUND=return] files

#protocols:  nisplus [NOTFOUND=return] files

#rpc:        nisplus [NOTFOUND=return] files

#ethers:     nisplus [NOTFOUND=return] files

#netmasks:   nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers:     files

netmasks:   files

networks:   files

protocols:  files

rpc:        files

services:   files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus

aliases:    files nisplus

[root@dnsoel55 named]#

 Pro DNS and Bind

September 5, 2010 Posted by | oracle | 23 Comments