Setup Bind, NTP and DHCP on a separate Virtualbox system

 

Even if you are using a DNS, Oracle recommends to list the public IP, VIP and private addresses for each node in the hosts file on each node.

For more details please read   following link.

Generic setup considerations

Domain:         example.com
RAC Sub-Domain: oracle_gns.example.com    192.168.1.55
Name Server:    gns.example.com           192.168.1.50
DHCP Server:    gns.example.com
NTP  Server:    gns.example.com
DHCP adresses:  192.168.1.100 ... 192.168.1.254

Cluster Name       : GRACE2
SCAN Name          : scan.oracle-gns.example.com
SCAN Port:         : 1521
RAc Sub Domain     : oracle-gns.example.com
GNS VIP Address    : 192.168.1.55

 

Configure DNS

Identity        Home Node    Host Node                         Given Name             Type     Address  Address        Assigned By        Resolved By
 GNS VIP        None         Selected by Oracle Clusterware    oracle_gns.example.com         Virtual   192.168.1.50   Net administrator  DNS
 Node 1 Public  Node 1       grac1                             grac1                          Public    192.168.1.60   Fixed              GNS & DNS
 Node 1 VIP     Node 1       Selected by Oracle Clusterware    grac1vip                       Private   Dynamic        DHCP               GNS
 Node 1 Private Node 1       grac1int                          grac1int                       Private   192.168.1.61   Fixed              GNS
 Node 2 Public  Node 2       grac2                             grac2                          Public    192.168.1.70   Fixed              GNS & DNS
 Node 2 VIP     Node 2       Selected by Oracle Clusterware    grac2vip                       Private   Dynamic        DHCP               GNS
 Node 2 Private Node 2       grac2int                          grac2int                       Private   192.168.1.71   Fixed              GNS
 SCAN VIP 1     none         Selected by Oracle Clusterware    scan.oracle_gns.example.com    Virtual   Dynamic        DHCP               GNS
 SCAN VIP 2     none         Selected by Oracle Clusterware    scan.oracle_gns.example.com    Virtual   Dynamic        DHCP               GNS
 SCAN VIP 3     none         Selected by Oracle Clusterware    scan.oracle_gns.example.com    Virtual   Dynamic        DHCP               GNS

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

 

Install BIND / DHCP

Install – Make sure the following rpms are installed:

dhcp-common-4.1.1-34.P1.0.1.el6 
dhcp-common-4.1.1-34.P1.0.1.el6.x86_64 
bind-9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm 
bind-libs-9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm 
bind-utils-9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm
Install Bind packages
 # rpm -Uvh bind-9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm bind-libs9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm
 bind-utils-9.8.2-0.17.rc1.0.2.el6_4.4.x86_64.rpm

 

Configure DNS

/etc/named.conf :
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
    listen-on port 53 {  192.168.1.50; };
    # listen-on-v6 port 53 { ::1; };
    directory     "/var/named";
    dump-file     "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { localhost; any; };
    recursion yes;
    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;
    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
    managed-keys-directory "/var/named/dynamic";
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
    type hint;
    file "named.ca";
};
zone    "1.168.192.in-addr.arpa" IN { // Reverse zone
    type master;
        notify no;
    file "192.168.1.db";
    allow-update { none; };
};
zone    "example.com" IN {
    type master;
        notify no;
    file "example.com.db";
    allow-update { none; };
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

create the zone information for the example.com :  /var/named/example.com.db 
$TTL 1H         ; Time to live
$ORIGIN example.com.
@       IN      SOA     gns  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
;
                  A         192.168.1.50
                  NS        gns ; name server for example.com
gns               A         192.168.1.50
grac1             A         192.168.1.60
grac1int          A         192.168.1.61
grac2             A         192.168.1.70
grac2int          A         192.168.1.71
grac3             A         192.168.1.80
grac3int          A         192.168.1.81
oracle-gns        A         192.168.1.55 ; A record for the GNS
;
;sub-domain(oracle-gns.example.com) definitions
$ORIGIN oracle-gns.example.com.
@      IN         NS        orcle-gns.example.com.     ; name server for the oracle-gns.example.com

create reverse zone information in /var/named/192.168.1.db 
$TTL 1H
@       IN      SOA     gns  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        gns.example.com.
50            PTR       gns.example.com.
55            PTR       oracle-gns.example.com. ; reverse mapping for GNS
60            PTR       grac1.example.com. ; reverse mapping for GNS
61            PTR       grac1int.example.com. ; reverse mapping for GNS
70            PTR       grac2.example.com. ; reverse mapping for GNS
71            PTR       grac2int.example.com. ; reverse mapping for GNS
80            PTR       grac3.example.com. ; reverse mapping for GNS
81            PTR       grac3int.example.com. ; reverse mapping for GNS

Check Name server config file
 # named-checkconf /etc/named.conf
 --> Check /var/log/messages for errors

Start the DNS server
# service named restart
 Starting named:                                            [  OK  ]

Ensure DNS service restart on the reboot:
# chkconfig named on
# chkconfig --list named
 named              0:off    1:off    2:on    3:on    4:on    5:on    6:off

 

Edit /etc/resolve.conf on all the RAC node and application servers with DNS information.

/etc/resolv.conf :
 # Generated by NetworkManager
 search hh.example.com example.com
 nameserver 192.168.1.50

# nsloopkup 
>  gns.example.com
 Server:        192.168.1.50
 Address:    192.168.1.50#53
Name:    gns.example.com
Address: 192.168.128.50

>  192.168.1.50
 Server:        192.168.1.50
 Address:    192.168.1.50#53
50.1.168.192.in-addr.arpa    name = gns.example.com.

 

Querying Domain Name System (DNS) name servers with DIG

 #  dig example.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.0.2.el6_4.4 <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7032
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;example.com.            IN    A
;; ANSWER SECTION:
example.com.        3600    IN    A    192.168.1.50
;; AUTHORITY SECTION:
example.com.        3600    IN    NS    gns.example.com.
;; ADDITIONAL SECTION:
gns.example.com.    3600    IN    A    192.168.1.50
;; Query time: 2 msec
;; SERVER: 192.168.1.50#53(192.168.1.50)
;; WHEN: Tue Jul  9 20:30:10 2013
;; MSG SIZE  rcvd: 79

Ohter dig commands 
#  dig oracle-gns.example.com
#  dig -x 192.168.1.50 

Configure DHCP server

etc/sysconfig/dhcpd: 
 # Command line options here
 DHCPDARGS="eth0"
/etc/dhcp/dhcpd.conf:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;                    # 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.1.255;                  # Default broadcast address to be used by DHCP client.
        option domain-name              "oracle-gns.example.com";
        option domain-name-servers      192.168.1.50;                   # IP address of the DNS server. In this document it will be oralab1
        option time-offset              -19000;                           # Central Standard Time
        option ntp-servers              0.pool.ntp.org;                   # Default NTP server to be used by DHCP clients
        range                           192.168.1.100 192.168.1.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;
}

Start DHCP server:
# service dhcpd start 
# chkconfig dhcpd on
Test DHCP client 
 # dhclient eth0

 Check /var/log/messages
 #  tail -f /var/log/messages
 Jul  8 12:46:09 gns dhclient[3909]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7 (xid=0x6fb12d80)
 Jul  8 12:46:09 gns dhcpd: DHCPDISCOVER from 08:00:27:e6:71:54 via eth0
 Jul  8 12:46:10 gns dhcpd: 0.pool.ntp.org: temporary name server failure
 Jul  8 12:46:10 gns dhcpd: DHCPOFFER on 192.168.1.100 to 08:00:27:e6:71:54 via eth0
 Jul  8 12:46:10 gns dhclient[3909]: DHCPOFFER from 192.168.1.50
 Jul  8 12:46:10 gns dhclient[3909]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x6fb12d80)
 Jul  8 12:46:10 gns dhcpd: DHCPREQUEST for 192.168.1.100 (192.168.1.50) from 08:00:27:e6:71:54 via eth0
 Jul  8 12:46:10 gns dhcpd: DHCPACK on 192.168.1.100 to 08:00:27:e6:71:54 via eth0
 Jul  8 12:46:10 gns dhclient[3909]: DHCPACK from 192.168.1.50 (xid=0x6fb12d80)
 Jul  8 12:46:12 gns avahi-daemon[1407]: Registering new address record for 192.168.1.100 on eth0.IPv4.
 Jul  8 12:46:12 gns NET[3962]: /sbin/dhclient-script : updated /etc/resolv.conf
 Jul  8 12:46:12 gns dhclient[3909]: bound to 192.168.1.100 -- renewal in 9071 seconds.
 Jul  8 12:46:13 gns ntpd[2051]: Listening on interface #6 eth0, 192.168.1.100#123 Enabled

NTP Setup:  Server ntp.conf  –  gns.example.com

/etc/ntp.conf: 
restrict default nomodify notrap noquery
restrict 127.0.0.1 
# -- CLIENT NETWORK -------
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# --- OUR TIMESERVERS -----  can't reach NTP servers - build my own server 
#server 0.pool.ntp.org iburst
#server 1.pool.ntp.org iburst
server 127.127.1.0
# --- NTP MULTICASTCLIENT ---
# --- GENERAL CONFIGURATION ---
# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 9
# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008
# Keys file.
keys /etc/ntp/keys

Enable NTP and query the current time
# chkconfig ntpd on
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.           9 l   11   64  377    0.000    0.000   0.000

NTP Setup – Clients: grac1.example.com, grac2.example.com,  …

Enable NTP with the –x option to allow for gradual time changes, also referred to as slewing
/etc/sysconfig/ntpd
# OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
to 
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
Restart NTPD daemon
[root@ract1 ~]#  service ntpd  restart

/etc/ntp.conf
restrict default nomodify notrap noquery
restrict 127.0.0.1 
# -- CLIENT NETWORK -------
# --- OUR TIMESERVERS ----- 
# 192.168.1.2 is the address for my timeserver,
# use the address of your own, instead:
server 192.168.1.50 
server  127.127.1.0
# --- NTP MULTICASTCLIENT ---
# --- GENERAL CONFIGURATION ---
# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 12
# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008
# Keys file.
keys /etc/ntp/keys

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 gns.example.com LOCAL(0)        10 u   22   64    1    2.065  -11.015   0.000
 LOCAL(0)        .LOCL.          12 l   21   64    1    0.000    0.000   0.000

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *