Configuring DNS and DHCP to use on Oracle Grid Naming Service

Configuring DNS and DHCP to use it on Oracle Grid Named Service
This configuration will be on the same server Oracle Linux 6, I installed just to ensure that Oracle clusterware will be working fine with GNS option, so if there is any subjection about this configuration let me know. As of now it is working fine with all the configurations that I have done with it.

DNS

Installing DNS

[root@dns ~]# yum install bind-libs bind bind-utils -y

Starting DNS service

[root@dns yum.repos.d]# service named start
Starting named: named: already running [ OK ]

Configure DNS to start after reboot

[root@dns yum.repos.d]# chkconfig named on
[root@dns yum.repos.d]#

DNS Configuration files

Now we have to configure the following files

  • DNS configuration file
    /etc/named.conf
  • domain zone file
    /var/named/example.com.zone
  • reverse dns zone file
    /var/named/1.168.192.in-addr.arpa
  • Resolv file
    /etc/resolv.conf

DNS configuration file /etc/named.conf

[root@dns ~]# cat /etc/named.conf
options {
directory "/var/named"; // Base directory for named
allow-transfer {"none";}; // Slave serves that can pull zone transfer. Ban everyone by default
};

zone "example.com" IN {
type master;
notify no;
file "example.com.zone";

};

zone "100.168.192.in-addr.arpa." IN {
type master;
notify no;
file "100.168.192.in-addr.arpa";
};

The IPs will be distributed as following:

# Public (eth0)
192.168.100.101 host01.example.com host01
192.168.100.102 host02.example.com host02
192.168.100.103 host03.example.com host03
192.168.100.99 gns.example.com gns
192.168.100.175 dns.example.com dns

We will include just the public IPs on the DNS configuration due will be mapping the virtual IPs and SCAN IPs with GNS.

Domain zone file /var/named/example.com.zone

[root@dns ~]# cat /var/named/example.com.zone
$TTL 1H
@ IN SOA dns.example.com. root.example.com.(
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
A 192.168.100.175
NS dns ; name server for example.com
dns A 192.168.100.175
host01 A 192.168.100.101
host02 A 192.168.100.102
host03 A 192.168.100.103
gns A 192.168.100.99 ; A record for the GNS
;
;sub-domain(cluster01.example.com) definitions
$ORIGIN cluster01.example.com.
@ IN NS gns.example.com. ; name server for the cluster01.example.com

Reverse dns zone file /var/named/1.168.192.in-addr.arpa

[root@dns ~]# cat /var/named/100.168.192.in-addr.arpa
$TTL 1H
@ IN SOA dns root.example.com. (
2009011201 ; serial (todays date + todays serial #)
3H ; refresh 3 hours
1H ; retry 1 hour
1W ; expire 1 week
1D ) ; minimum 24 hour
;
NS dns.example.com.
175 PTR dns.example.com.
99 PTR gns.example.com. ; reverse mapping for GNS
101 PTR host01.example.com.
102 PTR host02.example.com.
103 PTR host03.example.com.
[root@dns ~]#

After that all is set, we have check if the configuration is okay, We cant do nslookup to SCAN IP because it is not create yet, this resource will be create on clusterware installation process and it will be handle by GNS so just test with dig command the gns.example.com and the IP address (192.168.100.99) is pointing to the right place.

Issue the dig command from all RAC nodes

[root@dns named]# dig gns.example.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.1 <<>> gns.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER< ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;gns.example.com. IN A

;; ANSWER SECTION:
gns.example.com. 3600 IN A 192.168.100.99

;; AUTHORITY SECTION:
example.com. 3600 IN NS dns.example.com.

;; ADDITIONAL SECTION:
dns.example.com. 3600 IN A 192.168.100.175

;; Query time: 4 msec
;; SERVER: 192.168.100.175#53(192.168.100.175)
;; WHEN: Sun Mar 19 02:31:12 2017
;; MSG SIZE rcvd: 83

[root@dns named]#

Above command shows(highlighted) gns.example.com is resolving to 192.168.100.99, which is the GNS address. Now check the reverse name resolution is working also.

[root@dns named]# dig -x 192.168.100.99

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.1 <<>> -x 192.168.100.99
;; global options: +cmd
;; Got answer:
;; ->>HEADER< ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;99.100.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
99.100.168.192.in-addr.arpa. 3600 IN PTR gns.example.com.

;; AUTHORITY SECTION:
100.168.192.in-addr.arpa. 3600 IN NS dns.example.com.

;; ADDITIONAL SECTION:
dns.example.com. 3600 IN A 192.168.100.175

;; Query time: 3 msec
;; SERVER: 192.168.100.175#53(192.168.100.175)
;; WHEN: Sun Mar 19 02:32:32 2017
;; MSG SIZE rcvd: 108

[root@dns named]#

That’s it. The DNS configuration is completed

DHCP

Installing the binaries

yum install dhcp -y

Edit the following configuration file

vi /etc/dhcp/dhcpd.conf

#paste this entry
ddns-update-style interim;
ignore client-updates;

subnet 192.168.100.0 netmask 255.255.255.0 {

option subnet-mask 255.255.255.0;
option domain-name "example.com";

range 192.168.100.115 192.168.100.254;
default-lease-time 21600;
max-lease-time 43200;

}

ddns-update-style interim;
ignore client-updates;
subnet 192.168.128.0 netmask 255.255.255.0 {
option routers 192.168.100.175; # Default gateway to be used by DHCP clients
option subnet-mask 255.255.255.0; # Default subnet mask to be used by DHCP clients.
option ip-forwarding off; # Do not forward DHCP requests.
option broadcast-address 192.168.100.255; # Default broadcast address to be used by DHCP client.
option domain-name "example.com";
option domain-name-servers 192.168.100.175; # IP address of the DNS server. In this document it will be oralab1
option time-offset -19000; # Central Standard Time
range 192.168.100.115 192.168.100.254; # Range of IP addresses that can be issued to DHCP client
default-lease-time 21600; # Amount of time in seconds that a client may keep the IP address
max-lease-time 43200;
}

Edit /etc/sysconfig/dhcpd to configure settings for the DHCP server. the following entry specifies the interfaces on which the server listens for DHCP requests, in this case I am using eth2 and eth4:

#vi /etc/sysconfig/dhcpd
DHCPDARGS="eth2 eth4"

Touch the /var/lib/dhcpd/dhcpd.leases file, which stores information about client leases:

# touch /var/lib/dhcpd/dhcpd.leases

Enter the following commands to start the DHCP service and ensure that it starts after a reboot:

# service dhcpd start
# chkconfig dhcpd on

If you have any issue starting dhcp demon, you can execute the following command

#dhcpd

#example
[root@dns ~]# service dhcpd status
dhcpd is stopped
[root@dns ~]# dhcpd
Internet Systems Consortium DHCP Server 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Wrote 10 leases to leases file.
Listening on LPF/eth4/08:00:27:c8:74:ab/192.168.100.0/24
Sending on LPF/eth4/08:00:27:c8:74:ab/192.168.100.0/24

No subnet declaration for eth2 (10.0.3.15).
** Ignoring requests on eth2. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth2 is attached. **

No subnet declaration for eth3 (192.168.1.175).
** Ignoring requests on eth3. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth3 is attached. **

Sending on Socket/fallback/fallback-net
[root@dns ~]# service dhcpd status
dhcpd (pid 2790) is running...

also you can check if dhcp is offering IPs checking on /var/log/messages

#example
[root@dns ~]# tail -f /var/log/messages
Apr 20 16:44:22 dns dhcpd: DHCPDISCOVER from 00:00:00:00:00:00 via eth4
Apr 20 16:44:23 dns dhcpd: DHCPOFFER on 192.168.100.123 to 00:00:00:00:00:00 via eth4
Apr 20 16:44:23 dns dhcpd: DHCPREQUEST for 192.168.100.123 (192.168.100.175) from 00:00:00:00:00:00 via eth4
Apr 20 16:44:23 dns dhcpd: DHCPACK on 192.168.100.123 to 00:00:00:00:00:00 via eth4
Apr 20 16:44:23 dns dhcpd: DHCPDISCOVER from 00:00:00:00:00:00 via eth4
Apr 20 16:44:24 dns dhcpd: DHCPOFFER on 192.168.100.124 to 00:00:00:00:00:00 via eth4
Apr 20 16:44:24 dns dhcpd: DHCPREQUEST for 192.168.100.124 (192.168.100.175) from 00:00:00:00:00:00 via eth4
Apr 20 16:44:24 dns dhcpd: DHCPACK on 192.168.100.124 to 00:00:00:00:00:00 via eth4
Apr 20 16:44:24 dns dhcpd: DHCPDISCOVER from 00:00:00:00:00:00 via eth4
Apr 20 16:44:25 dns dhcpd: DHCPOFFER on 192.168.100.121 to 00:00:00:00:00:00 via eth4
Apr 20 16:44:25 dns dhcpd: DHCPREQUEST for 192.168.100.121 (192.168.100.175) from 00:00:00:00:00:00 via eth4
Apr 20 16:44:25 dns dhcpd: DHCPACK on 192.168.100.121 to 00:00:00:00:00:00 via eth4

So that’s all.

One thought on “Configuring DNS and DHCP to use on Oracle Grid Naming Service

  1. Pingback: Oracle Clusterware 12cR1 with Flex Cluster and GNS on Oracle Linus 6 (Virtual Box) | An Oracle DBA Journey

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s