31.4 Configuring the Primary DNS

   

A DNS server process is called named , which is started at system boot time when the system enters in run level 2. Automatic startup of the DNS server process is controlled by the NAMED variable in the /etc/rc.config.d/namesvrs file. If the value of this variable is 1, named is started at boot time. The startup script for the domain name server is /sbin/init.d/named . The named process looks into its configuration file, /etc/named.boot , which contains a list of domain names served by the server. The basic DNS configuration process on HP-UX is not complicated and is completed using the hosts_to_named command-line utility provided with HP-UX. The process consists of the following steps.

  1. Register your own domain name with one of the registrars on the Internet. Before that, you must have the IP addresses being used on your network. You have to provide two IP addresses of hosts that will be used as primary and secondary name servers for your domain.

  2. Create a list of host names and corresponding IP addresses in the /etc/hosts file on the system that will be used as the primary domain name server. You can add host name aliases in the file. This file should look like the following.

     192.168.3.10   myhp.boota.com  myhp 192.168.3.12   hp0.boota.com   hp0 127.0.0.1      localhost       loopback 
  3. Create a directory /etc/named.data using the mkdir command.

  4. Go to this directory using the cd command.

  5. Create a file named param that will be used by hosts_to_named to create DNS data files. The file that I used when creating the examples in this chapter contains the following lines.

     -d boota.com -n 192.168.3 -z 192.168.3.10 -b /etc/named.boot -s 

    The -d option shows the domain name. The -n option shows the network number used in this domain. The -z option creates the configuration file for the secondary name server. The IP address used with this option is for the primary name server. This IP address is used by the secondary server to download data files from the primary server. The -s option adds a name server (NS) resource record entry in the configuration file.

  6. Run hosts_to_named to create server configuration and data files. You will see output of this command like that shown next .

     #  hosts_to_named -f param  Translating /etc/hosts to lower case ... Collecting network data ...         192.168.3 Creating list of multi-homed hosts ... Creating "A" data (name to address mapping) for net   192.168.3 ... Creating "PTR" data (address to name mapping) for net   192.168.3 ... Creating "MX" (mail exchanger) data ... Building default named.boot file ... Building default db.cache file ... WARNING: db.cache must be filled in with          the name(s) and address(es) of the          rootserver(s) Building default boot.sec.save for secondary servers ... Building default boot.sec for secondary servers ... Building default boot.cacheonly for caching only servers ... done # 

    This command creates several files as shown in Table 31-1.

  7. Download the db.cache file from the Internet and copy it into the /etc/named.data directory. This file contains addresses of root name servers present on the Internet. You can find it on several servers on the Internet.

  8. Modify the /etc/rc.config.d/namesvrs file so that the named process starts every time you boot the system. Change the value of the NAMED variable to 1 in this configuration file.

  9. Start the DNS server using the following command.

     /sbin/init.d/named start 

    If everything goes well, the name server should be running fine at this point. Use the following command to verify that the named process is running.

     ps -efgrep named 
Table 31-1. Files Created by the hosts_to_named Command
File Name Description
/etc/named.data/boot.cacheonly Boot file for a caching server. This should be copied as /etc/named.boot to a caching server, if one if being used.
/etc/named.data/boot.sec.save Boot file for a secondary server that saves DNS data files on its disk. This file should be copied as /etc/named.boot on the secondary server.
/etc/named.data/boot.sec Boot file for a secondary server that does not save data files on its disk. This file should be copied as /etc/named.boot on the secondary server.
/etc/named.data/db.boota File contains host names to IP address mapping for all hosts in domain boota.com .
/etc/named.data/db.192.168.3 File contains reverse host name mapping (IP to host name) for hosts in network 192.168.3.
/etc/named.data/db.127.0.0 File contains mapping for the loopback address.
/etc/named.boot Boot file used by the named process.

DNS Configuration Files

Let's have a closer look at the DNS configuration and data files. At startup time, named looks for the /etc/named.boot file. This file contains a list of domain names served by the DNS and their related data files. It also contains the name of the directory where these data files are located. Following is a sample /etc/named.boot file. Lines starting with a semicolon in these files are treated as comments.

 ; ; type          domain                  source file ; directory       /etc/named.data ; running directory for named primary         0.0.127.IN-ADDR.ARPA    db.127.0.0 primary         boota.com                db.boota primary         3.168.192.IN-ADDR.ARPA        db.192.168.3 cache           .                       db.cache 

This file shows that the data files are stored in the /etc/named.data directory and that this is a primary server for domain boota.com . The host name data base is stored in file db.boota and the db.192.168.3 file is used for reverse name lookup.

The loopback data file db.127.0.0 is shown next. It contains a pointer to the local host only. Its structure is almost the same everywhere.

 @       IN      SOA     myhp.boota.com. root.myhp.boota.com. (                                   1       ; Serial                                   10800   ; Refresh every 3 hours                                   3600    ; Retry every hour                                   604800  ; Expire after a week                                   86400 ) ; Minimum ttl of 1 day         IN      NS      myhp.boota.com. 1       IN      PTR     localhost. 

File db.192.168.3 is used for mapping host names to IP addresses. A sample file is shown here. It should contain all hosts in network 192.168.3.

 @       IN      SOA     myhp.boota.com. root.myhp.boota.com. (                                   1       ; Serial                                   10800   ; Refresh every 3 hours                                   3600    ; Retry every hour                                   604800  ; Expire after a week                                   86400 ) ; Minimum ttl of 1 day         IN      NS      myhp.boota.com. 10      IN      PTR     myhp.boota.com. 12      IN      PTR     hp0.boota.com. 

File db.boota is used for mapping host names to IP addresses. It contains all hosts in domain boota.com . A sample file is shown here having two host names, myhp and hp0 .

 @       IN      SOA     myhp.boota.com. root.myhp.boota.com. (                                   1       ; Serial                                   10800   ; Refresh every 3 hours                                   3600    ; Retry every hour                                   604800  ; Expire after a week                                   86400 ) ; Minimum ttl of 1 day         IN      NS      myhp.boota.com. localhost   IN      A       127.0.0.1 myhp        IN      A       192.168.3.10 hp0         IN      A       192.168.3.12 myhp        IN      MX      10      myhp.boota.com. hp0         IN      MX      10      hp0.boota.com. 

File db.cache contains addresses of root name servers. It can be downloaded from several servers on the Internet. It is standard for all name servers and is shown next.

 ; ;   This file holds the information on root name servers needed to ;   initialize cache of Internet domain name servers ;   (e.g. reference this file in the "cache  .  <file>" ;   configuration file of BIND domain name servers). ; ;   This file is made available by InterNIC registration services ;   under anonymous FTP as ;       file                /domain/named.root ;       on server           FTP.RS.INTERNIC.NET ;   -OR- under Gopher at    RS.INTERNIC.NET ;       under menu          InterNIC Registration Services (NSI) ;          submenu          InterNIC Registration Archives ;       file                named.root ;     last update:    Oct 5, 1994 ;   related version of root zone:   94100500 ; .                        99999999 IN  NS    NS.INTERNIC.NET. NS.INTERNIC.NET.         99999999     A     198.41.0.4 .                        99999999     NS    NS1.ISI.EDU. NS1.ISI.EDU.             99999999     A     128.9.0.107 .                        99999999     NS    C.PSI.NET. C.PSI.NET.               99999999     A     192.33.4.12 .                        99999999     NS    TERP.UMD.EDU. TERP.UMD.EDU.            99999999     A     128.8.10.90 .                        99999999     NS    NS.NASA.GOV. NS.NASA.GOV.             99999999     A     128.102.16.10                          99999999     A     192.52.195.10 .                        99999999     NS    NS.ISC.ORG. NS.ISC.ORG.              99999999     A     192.5.5.241 .                        99999999     NS    NS.NIC.DDN.MIL. NS.NIC.DDN.MIL.          99999999     A     192.112.36.4 .                        99999999     NS    AOS.ARL.ARMY.MIL. AOS.ARL.ARMY.MIL.        99999999     A     128.63.4.82                          99999999     A     192.5.25.82 .                        99999999     NS    NIC.NORDU.NET. NIC.NORDU.NET.           99999999     A     192.36.148.17 ; End of File 

These files are used for running the primary domain name server. The following files are generated on the primary domain name server but are copied to another machine to be used as a secondary or caching server. Next is the boot.cacheonly file that is copied to a server intended to be used as a caching server. The file is renamed as /etc/named.boot on that server.

 ; ; type          domain                  source file ; directory       /etc/named.data ; running directory for named primary         0.0.127.IN-ADDR.ARPA    db.127.0.0 cache           .                       db.cache 

The boot.sec file is used for a secondary server. It is copied as /etc/named.boot on the secondary server. A secondary name server with this configuration file does not maintain its data base files on disk. It requires the primary server to be up at boot time. If the primary server is not up and running, the secondary server with this configuration does not start as it can't get its data base file. A sample boot.sec file is shown next. As you can see, this file contains the IP address of the primary name server ( 192.168.3.10 ).

 ; ; type          domain                  source file ; directory       /etc/named.data ; running directory for named primary         0.0.127.IN-ADDR.ARPA    db.127.0.0 secondary       boota.com        192.168.3.10 secondary       3.168.192.IN-ADDR.ARPA        192.168.3.10 cache           .                       db.cache 

The boot.sec.save file is copied to a secondary name server as /etc/named.boot . A secondary server with this configuration maintains its own data base files on disk, which are copies of the files on the primary name server. The secondary name server updates these files automatically after defined intervals of time. A sample boot.sec.save file is shown here.

 ; ; type          domain                  source file ; directory       /etc/named.data ; running directory for named primary         0.0.127.IN-ADDR.ARPA    db.127.0.0 secondary       boota.com        192.168.3.10 db.boota secondary       3.168.192.IN-ADDR.ARPA  192.168.3.10 db.192.168.3 cache           .                       db.cache 

Resource Records

Entries in DNS data base files are called resource records (RR). Some common types of RRs are:

A Address record. It is used for assigning an IP address to a host.
CNAME Used for host name aliases or canonical names. It is used to assign additional names to a host. For example, if you want to use a host name as Web server and ftp server, you can use CNAME to assign the host different names for both services.
HINFO Host information record. It shows host information such as operating system and CPU type. It is not commonly used.
MX Mail resource record. It is used with sendmail to deliver email. Mail server priorities can be set using this record.
NS Name server record. It shows the DNS server for a domain.
SOA Start of authority resource record. It contains information for the domain for which the server is authority and information for the secondary server.

Updating Data Base Files on the Primary Server

A DNS server reads its data base files at boot time. Every time you update these files, you have to ask the server to reload its files or restart the server. Although DNS data base files can be edited manually, the preferred method is as follows .

  1. Edit and update the /etc/hosts file used for the creation of data base files on the primary server.

  2. Go to the directory /etc/named.data where the param file resides.

  3. Run the hosts_to_named -f param command to regenerate DNS data files.

  4. Reload these files using the sig_named restart command.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net