Tuesday, July 10, 2018

Configure SCAN DNS for RAC 11G/12C using dnsmasq on OEL5/6

Dnsmasq is a simple way to set up a DNS server for a small network, rather than going to the trouble of configuring BIND.

Add Network Cards
Network Topology
IP Configuration
Dnsmasq Installation
Dnsmasq Configuration
Verification

Add Network Cards

- In my articles for RAC, I usually use three network cards for each of my nodes with following settings on VirtualBox
- In Network window, under Adapter 1, select Bridged Adapter for Public RAC interface

- In Network window, under Adapter 2, select Internal Network for Private RAC interface

- In Network window, under Adapter 3, select NAT for Internet connection

Network Topology

The planned addresses, hostnames and their purpose:

IP Address Host Name Description
192.168.0.101 rac1.oracleapps.com Public address of first node
192.168.0.102 rac2.oracleapps.com Public address of second node
192.168.0.111 rac1-vip.oracleapps.com Virtual address of first node
192.168.0.112 rac2-vip.oracleapps.com Virtual address of second node
192.168.1.101 rac1-priv.oracleapps.com Private address of first node
192.168.1.102 rac2-priv.oracleapps.com Private address of second node
192.168.0.121 rac-scan.oracleapps.com SCAN address of cluster
192.168.0.122 rac-scan.oracleapps.com SCAN address of cluster
192.168.0.123 rac-scan.oracleapps.com SCAN address of cluster

IP Configuration

Right-Click network Icon on task bar and select Edit Connections

Select System eth0 -> Edit

Check Connect automatically

Click tab IPv4 Settings
    Select Method to Manual from drop down list, then click Add and fill the following fields:
    Address: 192.168.0.101, Netmask: 255.255.255.0, Gateway: 192.168.0.1, DNS Servers: 127.0.0.1, Search domains: oracleapps.com
    Click Apply

Select System eth1 -> Edit then Check Connect automatically

Click tab IPv4 Settings
    Select Method to Manual from drop down list, then click Add and fill the following fields:
    Address: 192.168.1.101, Netmask: 255.255.255.0, Gateway: 192.168.1.1, DNS Servers: 127.0.0.1, Search domains: oracleapps.com
    Click Apply

Go to Terminal and restart the network services
# service network restart
Dnsmasq Installation

The Dnsmasq service is installed from a Yum repository using the following command:
# yum install dnsmasq
Turn on the Dnsmasq server and make sure it starts automatically on reboot.
# service dnsmasq start
# chkconfig dnsmasq on
Dnsmasq is configured by altering the contents of the "/etc/dnsmasq.conf" file and the contents of the "/etc/hosts" file.

The service can be stopped, started and restarted using the following commands.
# service dnsmasq stop
# service dnsmasq start
# service dnsmasq restart
Dnsmasq Configuration

You don't need to do any specific DNS configuration as Dnsmasq will use the contents of the "/etc/hosts" to resolve any name requests. Anything it can't find there will be forwarded to the nameservers listed in the "/etc/resolv.conf" file.

Adding the following entries to the "/etc/hosts" file on the server running Dnsmasq, will allow it to act as a DNS, resolving those names.
192.168.0.101 rac1.oracleapps.com  rac1
192.168.0.102 rac2.oracleapps.com  rac2
192.168.0.111 rac1-vip.oracleapps.com  rac1-vip
192.168.0.112 rac2-vip.oracleapps.com  rac2-vip
192.168.1.101 rac1-priv.oracleapps.com rac1-priv
192.168.1.102 rac2-priv.oracleapps.com rac2-priv
192.168.0.121 rac-scan.oracleapps.com  rac-scan
192.168.0.122 rac-scan.oracleapps.com  rac-scan
192.168.0.123 rac-scan.oracleapps.com  rac-scan
I’m using third network card as NAT with DHCP (For Internet) so each time you restart network card or reboot the server, the file /etc/resolv.conf is overwritten with automatically generated settings. Nameserver points for 192.168.0.1 which is required to resolve internet entries but not enough to resolve SCAN settings via dnsmasq.
# cat /etc/resolv.conf
# Generated by Networkmanager
nameserver 127.0.0.1
search oracleapps.com
nameserver 192.168.0.1
You must lock the file from being automatically overwritten by server reboot, network card restart etc.
# chattr +i /etc/resolv.conf
Verification

Once everything is setup, now test the IP lookup with nslookup command:
# nslookup rac1
Server:  127.0.0.1
Address: 127.0.0.1#53

Name: rac1.oracleapps.com
Address: 192.168.0.101

# nslookup rac2
Server:  127.0.0.1
Address: 127.0.0.1#53

Name: rac2.oracleapps.com
Address: 192.168.0.102

# nslookup rac1-priv
Server:  127.0.0.1
Address: 127.0.0.1#53

Name: rac1-priv.oracleapps.com
Address: 192.168.1.101

# nslookup ebsrac-scan
Server:  127.0.0.1
Address: 127.0.0.1#53

Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.123
Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.121
Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.122

# nslookup ebsrac-scan
Server:  127.0.0.1
Address: 127.0.0.1#53

Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.121
Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.122
Name: ebsrac-scan.oracleapps.com
Address: 192.168.0.123
You need to do all the above settings and configure dnsmasq on each node of the cluster.

No comments:

Post a Comment