HOSTCVT

Section: Maintenance Commands (8)
Updated: 10-3-90
Index Return to Main Contents
 

NAME

hostcvt - Convert hosts(5) file to BIND files  

SYNOPSIS

hostcvt [ -s soabasefile ] [ -n netfile ] [ -h hostfile ]

   [ -o outputfile ] domain  

DESCRIPTION

hostcvt reads a hosts(5) file specified by the hostfile argument ("hosts.thisdomain" by default), and converts them to BIND hostname-to-address and reverse tables for the argument domain. The names of the reverse files are specified in the argument netfile ("netlist" by default). If no output file is specified, the hostname to address table is put into a file in the current directory named domain. All files are prepended with the soabasefile ("soabasefile" by default) which is the SOA record for this domain (see example below).

Hostcvt issues warnings for any duplicated names (name to name, name to aliases, aliases to name and aliases to aliases) and will only allow the first instance of a name from hostsfile to be in the outputfile and the reverse table files. Lines in hostsfile that have an IP address but no hostname are ignored and a warning message is printed.

 

OPTIONS

-h hostsfile
Specify a file in hosts(5) format to read hosts from. The default is "hosts.thisdomain".
-n netfile
Specify a netfile. This file specifies the names of the reverse tables. The default is "netlist".

-o outputfile
Specify an output file for the hostname-to-address file. If unspecified, this file is the same as domainname.

-s soabasefile
Specify an SOA file. The default is "soabasefile".
 

FORMAT OF THE NETLIST FILE

netfile has the format:

netportion file

The netportion describes the portion of the address field which hostcvt is to pay attention to. The netportion should be all digits and dots necessary to do a strncmp() against the address portion of hostsfile, taking into account how the named.boot file is set up for the reverse address translation.

The file is the path to the file the reverse address for this netportion.

For example, suppose named.boot file has the following reverse translations:

primary     36.in-addr.arpa         net/net36
primary     0.101.in-addr.arpa      net/net101
primary     0.0.100.in-addr.arpa    net/net127
primary     63.134.in-addr.arpa     reversefile

For the net 36 addresses, the hostsfile would have entries of 36.xx.yy.zz, where all three lower portions would be used. For the net 101 addresses, the hosts.thisdomain file would have 101.0.yy.zz entries. And so forth.

The corresponding netfile would show:

36.         net/net36
101.0.      net/net101
100.0.0.    net/net100
134.63.     reversefile

It is VERY important that the trailing dot be in the netportion of the netfile. The program does a strncmp() against the host address field of hostsfile using the netportion string and it's length to get the exact match (O.K., so the program is a hack).

Hostcvt ignores lines starting with a # (pound sign) or empty (i.e. ^$ in egrep terms) lines in the netlist file. These may be used for comments or separation.  

FORMAT OF THE SOABASEFILE

The soabasefile is the SOA record which is prepended to all output files, and should be a valid SOA format. Here is the soabasefile for our domain (wr.tek.com):

@       IN      SOA     wrgate.wr.tek.com.      wrap.wrgate.wr.tek.com. (
                                1       ; Serial
                                3600    ; Refresh
                                300     ; Retry
                                3600000 ; Expire
                                14400 ) ; Minimum
                IN      NS      wrgate.wr.tek.com.

Note that the Serial number in the soabasefile should be advanced before hostcvt is run, rather than trying to change all the SOA records in the resulting files. The nextserial program is a convenient tool for changing the Serial numbers in files.  

EXAMPLE USAGE

The following is what I do to convert my hostsfile into files for my domain:

nextserial soabasefile
hostcvt -s soabasefile wr.tek.com
 

SEE ALSO

hosts(5), nextserial(8)  

BUGS

It would also be nice to retain comments made in hostsfile.

 

AUTHOR

Roger S. Southwick
rogers@amadeus.wr.tek.com

Modifications by Mark Frost
mfrost@pyramid.com


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
FORMAT OF THE NETLIST FILE
FORMAT OF THE SOABASEFILE
EXAMPLE USAGE
SEE ALSO
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 06:17:30 GMT, December 12, 2024