While setting up a test ZFS storage pool for Oracle RAC recently, I had some problems with the configured iSCSI shares for my ZFS volumes, which I suspected to be caused by not having a valid DNS server running in my test environment. To get around this, I first downloaded some DNS configuration generation scripts from here.
My initial setup will be for Oracle RAC 10g, which doesn’t actually require a working DNS configuration. With Oracle RAC 11g and its SCAN (Single Cluster Access Name) naming, a DNS server is strongly recommended, however even this can be bypassed with an entry in the /etc/hosts file (not what you should be doing for a production system). But since it’s better to know how to do something and not require it, rather than vice versa, I will be creating a domain with the name niradj.com for the purpose of my test environment.
After copying and extracting on the server, I’ll start by creating required files and directories, as well as editing and copying as required:
mkdir /var/named
cp /h2n-2.56/h2n /var/named/
cd /var/named
Note: Before proceeding to create entries for the domain, first I have edited the /etc/hosts file to contain both the simple hostname, and also the fully qualified domain name for each of the servers in my configuration (sample shown here):
#
# Internet host table
#
127.0.0.1 localhost
# ZFS iSCSI target
192.168.247.150 solastorage solastorage.niradj.com loghost
# RAC Public IPs
192.168.247.131 solarac1 solarac1.niradj.com
192.168.247.132 solarac2 solarac2.niradj.com
Make sure that the DNS services on this node are running on my solastorage VM:
-bash-3.00# svcs -a | grep -i dns
disabled 10:05:00 svc:/network/dns/client:default
disabled 10:05:01 svc:/network/dns/server:default
-bash-3.00# svcadm enable dns/server
-bash-3.00# svcs -l dns/server
fmri svc:/network/dns/server:default
enabled true
state maintenance
next_state none
state_time Tue Feb 15 10:30:42 2011
logfile /var/svc/log/network-dns-server:default.log
restarter svc:/system/svc/restarter:default
contract_id
dependency require_all/none svc:/system/filesystem/local (online)
dependency require_any/error svc:/network/loopback (online)
dependency optional_all/error svc:/milestone/network (online)
Using the h2n script that I copied to /var/named earlier, I will create a DNS configuration, as follows:
cd /var/named
./h2n -d niradj.com -n 192.168.247 10.10.10 -u hostmaster.niradj.com
Initializing new database files…
Reading host file `/etc/hosts’…
Line 4: Skipping; IP not within range specified by -n/-a options.
> 127.0.0.1 localhost
Writing database files…
Generating boot and conf files…
Checking NS, MX, and other RRs for various improprieties…
Done.
Next, I downloaded a sample configuration file (named.root, this file is responsible for listing the named root servers that are required to initialize a domain name server, in other words, you’ll need a valid copy of this file in Solaris to ensure your DNS setup is working correctly). Move this file to the server, and also modify the required configuration files:
cp named.root /var/named/db.cache
cp /var/named/named.conf /etcvi /etc/nsswitch.files (change hosts entry to as follows):
hosts: files dnsecho “niradj.com” > /etc/defaultdomain
(change the solastorage VM’s default domain to the newly-configured niradj.com)echo “domain niradj.com” >> /etc/resolv.conf
echo “nameserver 192.168.247.150″ >> /etc/resolv.conf
(change the default name server resolution, now that we have a DNS setup configured)
The last step is to test our newly configured DNS server to ensure that it is working:
# svcadm disable dns/server
# svcadm enable dns/server
# nslookup solarac1
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac1.niradj.com
Address: 192.168.247.131# nslookup solarac2
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac2.niradj.com
Address: 192.168.247.132# nslookup solarac2.niradj.com
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac2.niradj.com
Address: 192.168.247.132# nslookup solarac1.niradj.com
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac1.niradj.com
Address: 192.168.247.131# nslookup 192.168.247.131
Server: 192.168.247.150
Address: 192.168.247.150#53
131.247.168.192.in-addr.arpa name = solarac1.niradj.com.# nslookup 192.168.247.132
Server: 192.168.247.150
Address: 192.168.247.150#53
132.247.168.192.in-addr.arpa name = solarac2.niradj.com.
By testing the simple hostname, fully qualified domain name and also the IP addresses itself, I’m able to ensure that there is a valid entry for all the servers listed in my DNS. But this test is limited to my solastorage VM, which is the actual host for the DNS server itself. To ensure that it’s also working fine from my actual destination servers, I will use the following (on both solarac1 and solarac2):
# echo “domain niradj.com” >> /etc/resolv.conf
# echo “nameserver 192.168.247.150″ >> /etc/resolv.conf
# vi /etc/nsswitch.conf (change the following line to read:)
hosts: files dns# nslookup solarac1
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac1.niradj.com
Address: 192.168.247.131# nslookup solarac2
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac2.niradj.com
Address: 192.168.247.132# nslookup solarac1.niradj.com
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac1.niradj.com
Address: 192.168.247.131# nslookup solarac2.niradj.com
Server: 192.168.247.150
Address: 192.168.247.150#53
Name: solarac2.niradj.com
Address: 192.168.247.132
Of course, for the above to work, the /etc/hosts file on each server must also have been edited to list the simple hostname as well as the fully qualified domain name (example above). And there we have it, a working DNS server for Solaris (without too much trouble, I would hope).