oracledba.help
SpecialTopics

dnsmasq Installation

Overview

Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server for LINUX. It can be used in VM environments to help test RAC and other clustered systems.

In its simplest form it can use the entries in your /etc/hosts file and act like a DNS server for them. It is meant to be installed on all systems that need DNS type emulation.

The below example uses the interface\ip enp0s3 and 192.168.56.71 (rac01). Change as required for your environment.

System Preparation

Config /etc/hosts With All Required Entries

dnsmasq will use your entries here to emulate DNS. Below is a two node RAC example.

#public:
192.168.56.71 rac01.localdomain	rac01
192.168.56.72 rac02.localdomain	rac02
#private:
192.168.10.1 rac01-priv.localdomain	rac01-priv
192.168.10.2 rac02-priv.localdomain	rac02-priv
#virtual:
192.168.56.81 rac01-vip.localdomain	rac01-vip
192.168.56.82 rac02-vip.localdomain	rac02-vip
#Scan:
192.168.56.91 rac-scan.localdomain	rac-scan
192.168.56.92 rac-scan.localdomain	rac-scan
192.168.56.93 rac-scan.localdomain	rac-scan

Test

Ensure each VM can ping each other.

Installation and Configuration

  1. If need be temporarily add an interface to VM to get to internet.
  2. Ensure you can ping google.com.
  3. yum install dnsmasq -y

Configure

  1. cp /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
  2. vi /etc/dnsmasq.conf
no-resolv
expand-hosts
local=/localdomain/
listen-address=127.0.0.1
listen-address=192.168.56.71
bind-interfaces

Edit /etc/resolv.conf

cp /etc/resolv.conf /etc/resolv.conf.orig

vi /etc/resolv.conf
nameserver 192.168.56.71
nameserver 127.0.0.1
search localdomain
Ensure resolv.conf cannot be overwritten (by vbox etc.)
chattr +i /etc/resolv.conf

To disable: chattr -i /etc/resolv.conf

Config and Start Service Startup

systemctl enable dnsmasq.service
service dnsmasq restart

Test

  1. Restart: shutdown -r now
  2. Confirm bi-directional pings still OK between all VMs.
  3. nslookup rac01
  4. nslookup rac02
  5. nslookup rac01-vip
  6. nslookup rac02-vip
  7. nslookup rac-scan
  8. nslookup rac-scan <= Order returned should change.
  9. nslookup rac-scan <= Order returned should change.

Appendix

/etc/sysconfig/network-scripts Options(2)

To Use /etc/resolv.conf

PEERDNS=no
#DNS1=8.8.8.8
#DNS2=8.8.8.9

To use network-scripts DNS Settings

#PEERDNS=no
DNS1=8.8.8.8
DNS2=8.8.8.9

Config Interface

Get Interface Config

ifconfig

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.25  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:fe06:d4da  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:06:d4:da  txqueuelen 1000  (Ethernet)

Edit ifcfg File

  1. cd /etc/sysconfig/network-scripts
  2. vi ifcfg-enp0s3
NAME=enp0s3
DEVICE=enp0s3
BOOTPROTO=static
HWADDR=08:00:27:06:d4:da
IPADDR=192.168.56.71
ONBOOT=yes
TYPE=Ethernet