Building a simple server to provide DNS, DHCP and NTP to support Grid Naming Services

Oracle 11g Grid Infrastructure provides the ability to use DHCP for all private interconnect address, as well as most VIP address but it does not provide an optimal method for producing names for these address to external clients. Grid Naming Services provides a solution to the naming problem. GNS is linked to the companies DNS server to provide names private interconnect and VIP addresses.

This document will detail the steps to build a VM to be used in a VirtualBox environment to serve as a DNS, DHCP and NTP server to support experimentation with all the of the technologies in Oracle Grid Infrastructure.

This documents assumes Oracle Enterprise Linux 5.4 is installed and that you have access to the root account.

Configure Static IP Address on Linux

First the VM needs to be configured with a static IP address. You will need to know the IP address range configured on your VirtualBox network along with the gatway IP and the netmask. All of these items can be found in the Network dialog under Preferences in the VirtualBox Manager GUI.

As the root user edit the file/etc/sysconfig/network-scripts/ifcfg-eth0. The original ifcfg-eth0 file will have contents similar to the following.

[root@util network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
HWADDR="08:00:27:5A:C7:AA"
NM_CONTROLLED="yes"
ONBOOT="no"
[root@util network-scripts]#

Make the following changes/additions:

ONBOOT=yes
TYPE=Ethernet
NETMASK= <netmask for your VM network)
IPADD= <IP address for this VM on your VM network)
GATEWAY= <gateway IP for your VM network)

Below is the ifcfg-eth0 for this VM after making the above changes.

[root@util network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
HWADDR="08:00:27:5A:C7:AA"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.56.121
GATEWAY=192.168.56.1
[root@util network-scripts]#

After making the above changes save the file and restart network services.

[root@util network-scripts]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
[root@util network-scripts]#

After restarting the network services you should similar output from ifconfig with your static IP configuration.

[root@util network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:5A:C7:AA  
          inet addr:192.168.56.121  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe5a:c7aa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:532 errors:0 dropped:0 overruns:0 frame:0
          TX packets:313 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:48963 (47.8 KiB)  TX bytes:48191 (47.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@util network-scripts]#

The /etc/hosts file has just basic local host configuration such as the following.

[root@util ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@util ~]# 

Clean up the /etc/hosts to just contain the loop back address and the static IP address and name of this VM.

[root@util ~]# cat /etc/hosts
127.0.0.1   	localhost.localdomain   localhost
192.168.56.121	util.odlabs.com		util
[root@util ~]#

Configure the DNS Server

This section describes the set up of an authoritative-only Name server, which provides the minimum DNS configuration needed for GNS. If you are doing this work on a VM with a fresh install you will need to insure that bind-9.3.6-4.P1.el5 or later is installed. At this time DNS should not be running or configured.

[root@util ~]# service named status
rndc: neither /etc/rndc.conf nor /etc/rndc.key was found
named is stopped
[root@util ~]# 

For the purposes of this document a new /etc/named.conf will be created that only contains zone definitions. The zones configured are:

The odlabs.com zone, which will provide resolution for the odlabs.com domain, or what ever domain you are using in your VM environment.

The localhost zone, which provides resolution of the name localhost

Two reverse mapping zones, one for the localhost and the other for the IP address under the odlabs.com zone.

All of the zone files are found in /var/named. Below are the contents for the bare /etc/named.confg

[root@util etc]# cat named.conf
options {
  directory "/var/named";
};
zone "odlabs.com" {
  type master;
  file "zone.odlabs.com";
};
zone "localhost" {
  type master;
  file "zone.localhost";
};
zone "56.168.192.in-addr.arpa" {
  type master;
  file "zone.56.168.192.in-addr.arpa.rev";
};
zone "0.0.127.in-addr.arpa" {
  type master;
  file "zone.0.0.127.in-addr.arpa.rev";
};

[root@util etc]#

Next we will look at each of the files in detail noting the items that should be changed for your environment.

file: zone.odlabs.com

[root@oddns named]# cat zone.odlabs.com
$TTL    1h
@               IN SOA          oddns.odlabs.com. root.localhost (
                                11              ; serial number of zone
                                1d              ; slave refresh (1 day)
                                2h              ; slave refresh time in case of problems (2 hours)
                                4w              ; slave expiration time (4 weeks)
                                1h              ; maximum caching time in case of failed lookus (1 hour)
                                )
@               IN NS           oddns.odlabs.com.
localhost       IN A            127.0.0.1
oddns           IN A            192.168.56.121
odrac1          IN A            192.168.56.122
odrac2          IN A            192.168.56.123
odrac3          IN A            192.168.56.124
$ORIGIN odgrid.odlabs.com.
@               IN NS           lab-gns.odgrid.odlabs.com.
                IN NS           oddns.odlabs.com.
lab-gns         IN A            192.168.56.150; 
[root@oddns named]#

The lines (2nd and 9th):

@               IN SOA          oddns.odlabs.com. root.localhost (

@               IN NS           oddns.odlabs.com.

Should be change to reflect the domain used in your VirtualBox environment.

The lines after localhost (line 10) and befefore $ORIGIN (line 15) are the hostnames and IP address of servers in your environment.

Starting at line 15 and continuing through the end of the file is the definition of the subdomain odgrid that is to be managed by GNS.

$ORIGIN odgrid.odlabs.com.
@               IN NS           lab-gns.odgrid.odlabs.com.
                IN NS           oddns.odlabs.com.
lab-gns         IN A            192.168.56.150;

The sub domain is odgrid. The name server for this sub domain is lab-gns (could be named anything.) This entry will delegate resolution of the subdomain, odgrid, to GNS VIP 192.168.56.150. Where is that IP coming from you might ask? The 192.168.56.150 is an IP address selected just prior to the beginning address used in the DHCP IP address pool

file: zone.localhost is the file used to provide resolution to localhost to the loopback address at 127.0.0.1. The contents of the file below can be copied into your environment as is with no modification.

[root@oddns named]# cat zone.localhost
$TTL    1h
@               IN SOA  @       root(
                                11      ; serial
                                1d      ; slave refresh
                                2h      ; slave retry
                                4w      ; slave expiration
                                1h      ; maximum caching
                                )
                IN NS           @
                IN A            127.0.0.1
[root@oddns named]#

file: zone.56.168.192-in-addr.arpa.rev is the reverse name lookup file.

[root@oddns named]# cat zone.56.168.192.in-addr.arpa.rev
$TTL    1h
@               IN SOA          oddns.odlabs.com. root.localhost (
                                11              ; serial number of zone
                                1d              ; slave refresh (1 day)
                                2h              ; slave refresh time in case of problems (2 hours)
                                4w              ; slave expiration time (4 weeks)
                                1h              ; maximum caching time in case of failed lookus (1 hour)
                                )
@               IN NS           oddns.odlabs.com.
121             IN PTR          oddns.odlabs.com.
122             IN PTR          odrac1.odlabs.com.
123             IN PTR          odrac2.odlabs.com.
124             IN PTR          odrac2.odlabs.com.
[root@oddns named]#

In this file lines 2 and 9 will need to be edited to reflect the domain used in your environment. Lines 10 through the end of the file have the last octet of each address for the machines in your environment followed by the fully qualified name.

file: zone.0.0.127.in-addr.arpa.rev is used for reverse mapping of the loopback address to localhost.

[root@oddns named]# cat zone.0.0.127.in-addr.arpa.rev
$TTL    1h
@               IN SOA          localhost. root.localhost. (
                                11      ; serial
                                1d      ; slave refresh
                                2h      ; slave retry
                                4w      ; slave expiration
                                1h      ; maximum caching
                                )
                IN NS           localhost.
1               IN PTR          localhost.
[root@oddns named]#

Modify /etc/resolv.conf on both the name server and all hosts that require name and address resolution. The search order will include both the main domain the subdomain managed by GNS.

[root@oddns named]# cat /etc/resolv.conf
search odlabs.com odgrid.odlabs.com
nameserver 192.168.56.121
[root@oddns named]#

Start the named service and use chkconfig to configure the service start automatically on reboots.

[root@oddns named]# service named start
Starting named:                                            [  OK  ]
[root@oddns named]# chkconfig named on
[root@oddns named]#

Turn off iptables and use chkconfig to configure the service to not start at boot.

[root@oddns ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@oddns ~]# chkconfig iptables off
[root@oddns ~]#

Configure DHCP server

Insure that dhcp-3.0.5-21.el5 or higher is installed on your system. The DHCP server configuration is in the file /etc/dhcp/dhcpd.conf. Below is an example dhcpd.conf that you can use for your system. You will need to make the following changes:

Subnet and netmask should be representative values from your environment.
Range should be a valid IP address range in your environment.
Router should be the gateway IP in your environment.
Subnet-mask should be valid for the range of IPs in your environment.
Domain-name should be the domain you are using.
Domain-name-servers is the IP address of DNS server in your environment which should be this VM.

[root@oddns dhcp]# cat dhcpd.conf
ddns-update-style interim;
ignore client-updates;
        subnet 192.168.56.0 netmask 255.255.255.0 {
                range                           192.168.56.151 192.168.56.170;
                option routers                  192.168.56.1;
                option subnet-mask              255.255.255.0;
                option domain-name              "odlabs.com";
                option domain-name-servers      192.168.56.121;
        }
[root@oddns dhcp]#

After making the changes to /etc/dhcp/dhcpd.conf start the dhcp service and use chkconfig to configure the service start automatically on reboots.

[root@oddns dhcp]# service dhcpd start
Starting dhcpd:                                            [  OK  ]
[root@oddns dhcp]# chkconfig dhcpd on
[root@oddns dhcp]#

Configure the NTP server

Insure that ntp-4.2.2p1-9.el5_3.2 or later is installed on the system. You NTPD configuration file located at /etc/ntp.conf and is basically ready to go. By default the NTPD is configured to get use rhel.pool.ntp.org. If you do not want to use those you can find free to use NTP servers near you at NTP.org.

If you decide to use different servers other than the rhel.pool.ntp.org servers comment/remove the following lines from /etc/ntp.conf and replace with servers of your choice.

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

After making changes start the NTP server with the following.

[root@oddns ~]# service ntpd start
Starting ntpd:                                             [  OK  ]
[root@oddns ~]# 

After staring the service, NTPD will slowly synchronize the server’s time with the time from the NTP servers. You can use the NTP query program ntpq to verify the you are able to connect to the NTP servers.

[root@oddns ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ccadmin.cycores 130.207.244.240  2 u   42   64    7  121.236  929.990  22.342
 4.53.160.75     220.183.68.66    2 u   36   64    7   69.944  912.612   6.073
 javanese.kjsl.c 69.36.224.15     2 u   37   64    7   94.059  908.775   0.870
 LOCAL(0)        .LOCL.          10 l   37   64    7    0.000    0.000   0.001
[root@oddns ~]#

If you made no changes or only changed the default servers you should see one line for each server configured plus on for LOCAL(0). If you look in /etc/ntp.conf you will see that LOCAL(0) is for when no outside source is available to synchronize time.

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

The last thing to do is make sure the NTPD service starts on boot. Use chkconfig to enable NTPD on boot.

[root@oddns ~]# chkconfig ntpd on
[root@oddns ~]#

After following all of the steps above you now have a VM ready to use as a DNS, DHCP and NTP server to support Grid Naming Services.

1 thought on “Building a simple server to provide DNS, DHCP and NTP to support Grid Naming Services”

  1. I think your website needs some fresh articles.
    Writing manually takes a lot of time, but there is tool for this time consuming task,
    search for; Ssundee advices unlimited content for any blog

Leave a Reply

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