Quick Setup Domain Name System (DNS) for Solaris 10

4
Updated 26 September 2006 © 2006 Logiqwest, Inc. All rights reserved. Quick Setup Domain Name System (DNS) for Solaris 10 Description: This procedure describes how to quickly setup a Solaris Domain Name System (DNS) using the h2n Perl Script provided. DNS or BIND uses a set of files converted from the data stored in the Unix system /etc/host file. This Quick Setup of DNS uses a Perl script called h2n that creates the appropriate files for a DNS server. Prerequisites: Super user access Obtain the h2n file contained in this tar-gz file. The latest version of this program can be obtained from ftp://ftp.hpl.hp.com /pub/h2n/h2n.tar.gz When you untar-gz this file it will create a directory called h2n-2.56. In this directory will be a script called h2n. This script will be used to create your DNS tables. Notes: The h2n script is provided with this documentation (h2n-2.56.tar.gz). h2n translates /etc/hosts to DNS zone files and creates BIND named.conf configuration files. This tool can be run once or many times. After converting your host table to DNS format, you can manually maintain the DNS files, or you can maintain the host table and run h2n each time you modify /etc/hosts. h2n automatically increments the serial number in each DNS file when it makes a new one. References: h2n Scripts h2n Scripts Documentation Step Action Description 1 Edit /etc/hosts file A simple Named Services system is created in the following manner: The new domain server will be on system 192.168.21.37 which is called utility. The following /etc/host file has been edit to contain all the DNS entries that are required: 127.0.0.1 localhost 192.168.21.37 utility utility.mydomain.com loghost 192.168.21.8 kadence kadence.mydomain.com 192.168.21.25 www www.mydomain.com myeb 192.168.21.26 mydev mydev.mydomain.com 192.168.21.32 mytest2-admin mytest2-admin.mydomain.com 192.168.21.33 myv20z myv20z.mydomain.com 192.168.21.34 myt1 myt1.mydomain.com 192.168.21.35 mytest mytest.mydomain.com 192.168.21.36 rlogic rlogic.mydomain.com 192.168.21.41 aix43p aix43p.mydomain.com Assume domain name is to be mydomain.com. Assume network is 192.168.21. Create a domain run directory to contain the Named services files called /var/named. Place the h2./n script is this directory. Run the h2n script file as follows: 2 #mkdir -p /var/named Create a domain run directory to contain the Named services files called /var/named. Place the h2n script is this directory from the untar gzip directory of h2n-2.56. See Prerequisite above. #mkdir -p /var/named Quick Setup Domain Name System (DNS) for Solaris 10 http://www.logiqwest.com/dataCenter/Demos/RunBooks/DNS/DNSsetup... 1 of 4 2/6/2011 3:04 PM

Transcript of Quick Setup Domain Name System (DNS) for Solaris 10

Page 1: Quick Setup Domain Name System (DNS) for Solaris 10

Updated 26 September 2006 © 2006 Logiqwest, Inc. All rights reserved.

Quick Setup Domain Name System (DNS)for Solaris 10

Description: This procedure describes how to quickly setup a Solaris Domain Name System (DNS) usingthe h2n Perl Script provided.DNS or BIND uses a set of files converted from the data stored in the Unix system/etc/host file. This Quick Setup of DNS uses a Perl script called h2n that creates theappropriate files for a DNS server.

Prerequisites: Super user accessObtain the h2n file contained in this tar-gz file.

The latest version of this program can be obtained from ftp://ftp.hpl.hp.com/pub/h2n/h2n.tar.gz

When you untar-gz this file it will create a directory called h2n-2.56. In this directory willbe a script called h2n. This script will be used to create your DNS tables.

Notes: The h2n script is provided with this documentation (h2n-2.56.tar.gz). h2n translates/etc/hosts to DNS zone files and creates BIND named.conf configuration files. This toolcan be run once or many times. After converting your host table to DNS format, you canmanually maintain the DNS files, or you can maintain the host table and run h2n eachtime you modify /etc/hosts. h2n automatically increments the serial number in each DNSfile when it makes a new one.

References: h2n Scriptsh2n Scripts Documentation

Step Action Description

1 Edit /etc/hosts file A simple Named Services system is created in the following manner:

The new domain server will be on system 192.168.21.37 which is called utility.The following /etc/host file has been edit to contain all the DNS entries thatare required:

127.0.0.1 localhost192.168.21.37 utility utility.mydomain.com loghost192.168.21.8 kadence kadence.mydomain.com192.168.21.25 www www.mydomain.com myeb192.168.21.26 mydev mydev.mydomain.com192.168.21.32 mytest2-admin mytest2-admin.mydomain.com192.168.21.33 myv20z myv20z.mydomain.com192.168.21.34 myt1 myt1.mydomain.com192.168.21.35 mytest mytest.mydomain.com192.168.21.36 rlogic rlogic.mydomain.com192.168.21.41 aix43p aix43p.mydomain.com

Assume domain name is to be mydomain.com.Assume network is 192.168.21.Create a domain run directory to contain the Named services files called/var/named.Place the h2./n script is this directory.Run the h2n script file as follows:

2 #mkdir -p /var/named Create a domain run directory to contain the Named services files called/var/named.Place the h2n script is this directory from the untar gzip directory of h2n-2.56.See Prerequisite above.

#mkdir -p /var/named

Quick Setup Domain Name System (DNS) for Solaris 10 http://www.logiqwest.com/dataCenter/Demos/RunBooks/DNS/DNSsetup...

1 of 4 2/6/2011 3:04 PM

Page 2: Quick Setup Domain Name System (DNS) for Solaris 10

#cp <from the ./h2n-2.56 directory>/h2n /var/named

3 # h2n -d <domain name> -n <network> -u <email>

Run the h2n script file as follows:bash-3.00#cd /varbash-3.00#mkdir namedbash-3.00#cp h2n namedbash-3.00#cd namedbash-3.00#./h2n -d mydomain.com -n 192.168.21 -u [email protected] new database files...Reading host file `/etc/hosts'...Line 28: 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.bash-3.00# lsboot.cacheonly db.127.0.0 h2n named.confconf.cacheonly db.192.168.21 db.mydomain named.boot

4 Obtain and copydb.cache files.

The named server needs to know where servers for root zones are. This information isin the file db.cache. This file must be added to the /var/named directory for theSolaris 10 DNS server to work. This file is obtained from the web. To create a db.cachefile, the information must be retrieved from the Internet host ftp.rs.internic.net(198.41.0.6). Use either ftp or a web browser to locate and download a file callednamed.root located in the domain directory.

Quick Setup Domain Name System (DNS) for Solaris 10 http://www.logiqwest.com/dataCenter/Demos/RunBooks/DNS/DNSsetup...

2 of 4 2/6/2011 3:04 PM

Page 3: Quick Setup Domain Name System (DNS) for Solaris 10

After downloading the named.root file. Simply rename the file to db.cache and copyto the /var/named directory.

bash-3.00# lsboot.cacheonly db.127.0.0 db.cache h2n named.confconf.cacheonly db.192.168.21 db.mydomain named.bootbash-3.00#

5 # cp named.conf /etc Copy the configuration file to the /etc directory.

6 Setup Network

6a Edit/etc/nsswitch.conf

Edit the file /etc/nsswitch.conf and add the entry dns to the host entry as follows:

#

# /etc/nsswitch.files:## An example file that could be copied over to /etc/nsswitch.conf; it# does not use any naming service.## "hosts:" and "services:" in this file are used only if the# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.passwd: filesgroup: fileshosts: files dnsnetworks: filesprotocols: files: : : : : :

Quick Setup Domain Name System (DNS) for Solaris 10 http://www.logiqwest.com/dataCenter/Demos/RunBooks/DNS/DNSsetup...

3 of 4 2/6/2011 3:04 PM

Page 4: Quick Setup Domain Name System (DNS) for Solaris 10

: : : : : :

The entry above means that for name resolution, the system will first look at the local/etc/hosts file and then use the dns server which in this case is itself.

6b Create/Edit/etc/defaultdomain

and

Set domain

Create or edit a file called /etc/defaultdomain and add the single entry:

#vi /etc/defaultdomain

mydomain.com

Execute the domainname command to set the domain as follows:

#domainname `cat /etc/defaultdomain`

6c Edit/etc/resolv.conf

For the /etc/resolv.conf file the following entries need to be established. This first isthe name of the domain (e.g. mydomain.com) that was assigned with the h2n script.The second is the nameserver address of the system maintaining that domain assignedlists (e.g. nameserver 192.168.21.37) of the domain:

#vi /etc/resolv.confnameserver 12.11.108.15nameserver 12.11.108.16domain mydomain.comnameserver 192.168.21.37

7 Start Named Services Named services can be started by issuing the command:

#/usr/sbin/in.named &

Note: This assumes that in Solaris 10 a service configuration repository has beenenabled to run. To enabled the respository use

svcs - report service statussvcadm - manipulate service instances

bash-3.00# svcs -a | grep dnsdisabled 10:15:21 svc:/network/dns/server:defaultdisabled 10:15:22 svc:/network/dns/client:defaultbash-3.00# svcadm enable /network/dns/serverbash-3.00# svcs -a | grep dnsonline 10:15:21 svc:/network/dns/server:defaultonline 10:15:22 svc:/network/dns/client:default

/network/dns/server must be online for DNS to run properly and initiate if the DNSserver is rebooted.

8 Configurating Clientsto use DNS

To use DNS, clients need to modify the /etc/resolv.conf, and /etc/nsswitch.confas above. The /etc/defaultdomain file must also be created and establsihed asabove.

Quick Setup Domain Name System (DNS) for Solaris 10 http://www.logiqwest.com/dataCenter/Demos/RunBooks/DNS/DNSsetup...

4 of 4 2/6/2011 3:04 PM