DESCRIPTION
hosts_to_named
translates the host table,
/etc/hosts,
into files that are usable by the name server
named(1M).
The format of these files is defined in
RFC1035.
The files are created in the current directory.
Once the host table is translated, the name server files
can be maintained directly, or the translation
can be repeated after each change to the host table.
If a line in the host table contains no domain names,
all names on the line are assumed to be in the default domain.
The first
domain
listed is the "default domain".
If data is being created for more than 1 domain
or if certain options are used,
there must be domain names in the host table
to determine which names belong in which domain.
The name server data is referred to as "resource records".
Options are:
- -a network-number
Add the information about hosts in the local domain from network
network-number.
This is the same as the
-n
option except that no pointer
(PTR)
data is created.
This is useful when there are multiple domains on a network
and a different server is handling the address-to-name mapping for
network-number.
- -b bootfile
Name the boot file
bootfile.
The default is
named.boot
in the current directory.
- -c subdomain
Create alias
(CNAME)
records for hosts in
subdomain
of the default domain.
When a subdomain is delegated, it is useful to create aliases
for the old names in the default domain
that point to the new names in the
subdomain.
After creating the alias
(CNAME)
records, ignore lines in the host table that contain names in the
subdomain.
This option can be used more than once on the command line.
This option requires domain names in the host table.
When the old names in this
domain
are no longer used, they can be ignored with the
-e
option.
If the
subdomain
name does not have dots, the default domain is appended to
subdomain.
- -d domain
Create data for
domain.
This option can be used more than once on the command line
if data is being created for more than 1 domain.
The first
domain
listed is the "default domain".
This option requires domain names in the host table
for all hosts in domains except the default domain.
- -e subdomain
Eliminate lines from the host table that contain names in the
subdomain
before translating.
If the
subdomain
name does not have dots, the default domain is appended.
This option may be used more than once on the command line.
This option requires domain names in the host table.
- -f file
Read command line options from
file.
The
-f
option is not allowed within a file.
- -h host
Declare
host
to be the host in the start of authority
(SOA)
record that the name server data was created on.
Also use
host
for the electronic mail address of the responsible user in the
SOA
record.
The default is the host this command is run on.
- -m weight:mailhub
For each canonical hostname from the host table, create mail exchanger
(MX)
records with the specified weight and mail hub.
The weight is a positive integer.
The mail hub is a hostname.
If the mail hub name has no dots, the default domain is appended.
This option can be used more than once on the command line.
- -n network-number[:mask]
Create data for
network-number.
See below for description of
network-number.
If only one
domain
is listed with
-d,
all data for
network-number
is assumed to be in
domain.
The optional subnet mask
mask
can be used instead of supplying each
network-number
for a subnet using multiple
-n
options.
mask
must be in dot notation.
- -o refresh:retry:expire:min
Set the values in the start-of-authority
(SOA)
record to those specified.
See below for description of the start-of-authority
(SOA)
record.
- -p domain
Create only pointer
(PTR)
data for hosts in
domain.
This is useful when there are multiple domains on a network
and a different server is responsible for
domain,
but this server is responsible for the address-to-name mapping.
This option can be used more than once on the command line.
This option requires domain names in the host table.
- -q
Run quietly.
No messages are printed.
- -r
Create name server data indicating that the name server
is authoritative for
.
(the root of the domain tree).
The file created is
db.root.
Use this only when your network is isolated from the
Internet.
If other root servers exist for the isolated network,
they must be added manually.
- -s server
Create name server
(NS)
records that declare
server
is an authoritative name server for all of the domains created.
If more than 1 server is authoritative, each needs to be declared.
If the server name does not have any dots in it,
the default domain is appended.
The default server is the host this script is run on.
This option can be used more than once on the command line.
- -t
Create text
(TXT)
records from the comments that appear with host data.
The comments will all be in lower case
because the host table is translated to lower case.
If
[no smtp]
appears in a comment, it is omitted.
The
[no smtp]
is used to control mail exchanger
(MX)
data.
- -u user
Declare
user
to be the electronic mail address of the person
responsible for this domain.
This is used in the start of authority
(SOA)
record.
The format required in the name server data is
user.host
(host must be a domain name).
If given as
user,
the host on which this script is run is appended.
If given as
user
@host,
the
@
is replaced with a dot
(.).
The default user is
root.
- -w
Create well known services
(WKS)
data declaring that the host provides the
SMTP
service.
This is done only when mail exchanger
(MX)
data is also being created and only for hosts without
[no smtp]
in a comment.
- -z internet-address
Create a secondary boot file,
boot.sec.save,
from the primary boot file listing
internet-address
as the server to load the data from.
The boot file has the server back up the data on disk.
The
internet-address
defaults to the value used with
-Z.
This option can be used more than once.
- -A
Do not create name server data for aliases in the host table.
- -C file
Create resource records from strings
in the comment field of the host table.
Each string in the comment field (except
[no smtp]
)
is searched for in
file.
The format of
file
is a string, a colon, and a resource record.
If the string in the comment field
matches the string before the colon in
file,
a resource record is added consisting of the name of the host
followed by everything after the colon from the matching line in
file.
For example, host information
(HINFO)
records can be created by adding
360:IN HINFO hp9000s360 hp-ux
to
file
and adding 360 to comments in the host table.
- -D
Do not create name server data for domain names in the host table.
- -F
By default, the serial number is incremented for a domain
only if the data has changed (pointer
(PTR)
data only).
This option forces the serial number to be incremented,
even if the data has not changed.
- -H host-file
Use
host-file
instead of
/etc/hosts.
- -M
Do not create mail exchanger
(MX)
records for hosts in the host table.
- -N mask
Apply the default subnet mask
mask
to each
network-number
specified with
-n
except for ones with their subnet masks already provided.
mask
must be in dot notation.
This is the same as supplying each
network-number
for a subnet using multiple
-n
options.
- -S server
This option is the same as the
-s
option, but it only applies to the last
domain
specified with
-d
or the last
network-number
specified with
-n.
This option is for when
server
is backing up some, but not all, of the domains.
- -Z internet-address
Create a secondary boot file,
boot.sec,
from the primary boot file listing
internet-address
as the server to load the data from.
The boot file does not have the server back up the data on disk.
The
internet-address
defaults to value used with
-z.
This option can be used more than once.
- -1
This option is obsolete.
hosts_to_named
translates the host table to lower case to help eliminate duplicate data.
Since the name server treats uppercase and lowercase as equivalent,
names that differ only in case are considered the same.
Alias
(CNAME)
records are created for
subdomains
delegated with
-c.
Lines from the host table that contain names in
subdomains
from
-c
and
-e
are removed from the lowercase copy of the host table.
The host table is then used to create the name server data for each
network-number
declared on the command line.
Do not include the trailing 0's in the network number.
No distinction is made between class A, B, or C addresses
nor is there any understanding of subnets
unless a subnet mask is supplied.
Example network numbers are:
10 (for all addresses of the form 10.*.*.*),
10.1 (for addresses of the form 10.1.*.*),
or 10.2.2 (for addresses of the form 10.2.2.*).
Address
(A)
records are created for mapping hostnames to
IP
addresses.
Alias
(CNAME)
records are created for aliases of hosts that are not multi-homed.
The data are placed in a file named
db.
DOMAIN
where
DOMAIN
is the first part of the domain from the command line.
For the domain
div.inc.com,
the file is named
db.div.
All other name server data goes in this file except the pointer
(PTR)
records described below.
Pointer
(PTR)
records are created for mapping
IP
addresses to host names.
PTR
records are placed in a file named
db.
NET
where
NET
is the network number from the command line.
Network 10 data is placed in
db.10.
Network 10.1 data are placed in "db.10.1".
Mail exchanger
(MX)
records are created unless the
-M
option is used.
The default
MX
record has a weight of 10 with the host itself as its mail exchanger.
No default
MX
record is created for a host if
[no
smtp]
is in the comment section of that line in the host table.
MX
records for each mail hub declared with the
-m
option are added for each host even if
[no smtp]
is in the comment section.
Well known services
(WKS)
records are created for each host that
handles
SMTP
mail (does not have
[no smtp])
if
-w
is used.
The only service listed is
SMTP.
Text
(TXT)
records are created for comments associated with hosts in the host table if
-t
is used.
The comments do not include
[no smtp].
For each domain, a start of authority
(SOA)
record is created.
The
SOA
record requires 2 domain names: the host
that the data is created on
and the electronic mail address of the person responsible.
The
-h
and
-u
options influence the names.
In addition, the
SOA
record requires 5 values: a serial number, a refresh time,
a retry time, an expire time, and a minimum ttl (time to live).
The first time the data is created,
the serial number is set to 1,
the refresh time is set to 3 hours,
the retry time is set to 1 hour,
the expire time is set to 1 week,
and the minimum ttl is set to 1 day.
The
-o
option changes these values except for the serial number.
Each subsequent time
hosts_to_named
is run, the serial number is incremented.
If any of the other fields in the
SOA
record are modified, the changed values are retained.
If there are files named
spcl.
DOMAIN
or
spcl.
NET
in the current directory,
$INCLUDE
directives are added to the corresponding
db.
DOMAIN
or
db.
NET
file for the
spcl
file.
In this way, special data can be added to the data generated by
hosts_to_named.
The first time
hosts_to_named
is run, it creates a default boot file for a primary name server.
Each subsequent time
hosts_to_named
is run, the boot file is updated if necessary.
New entries are made in the boot file
for any additional networks or domains
not already in the boot file.
No entries are deleted from the boot file.
The boot file for a caching-only server,
boot.cacheonly,
is created if it does not exist.
The boot files for secondary servers,
boot.sec.save
and
boot.sec,
are created if the
-z
or
-Z
options are used.
The boot files for secondary servers are created new
each time from the primary server boot file so that they are equivalent.
EXAMPLES
Create name server data for networks 15.19.8 and 15.19.9 in
div.inc.com.
hosts_to_named -d div.inc.com -n 15.19.8 -n 15.19.9
Create name server data for networks 15.19.8 and 15.19.9 in
div.inc.com.
Ignore aliases in the host table and include 2 mail hubs -
aaa.div.inc.com
and
bbb.mkt.inc.comk.
Put all of the options in a file.
hosts_to_named -f option_file
Option_file
contains the following lines:
-d div.inc.com
-n 15.19.8 -n 15.19.9
-m 20:aaa
-m 30:bbb.mkt.inc.com
-A
Network 15.19.15 has hosts in the
xx.inc.com
domain and the
div.inc.com
domain.
Create name server data for
xx.inc.com.
Create only pointer
(PTR)
data for hosts in
div.inc.com
on network 15.19.15
(this requires the hosts in
div.inc.com
to have the canonical name or an alias of the form
x.div.inc.com).
hosts_to_named -d xx.inc.com -n 15.19.15 -p div.inc.com
Create name server data for network 15.19.8 in
div.inc.com.
Include
div.inc.com
data from network 15.19.15 but do not create pointer
(PTR)
data for 15.19.15 since that is being handled by the
xx.inc.com
server.
hosts_to_named -d div.inc.com -n 15.19.8 -a 15.19.15