z2h - Convert BIND zone files to host files
perl z2h.pl [options]
Options: -? or --help This help message --man Complete documentation --license Display the license
--zonefile=<file> Full or relative path to zone file --hostfile=<file> Full or relative path to host file --multiple For each zone file write to a separate host file --nomultiple Write to one host file even if multiple zone files are given
--verbose *** TODO ***
z2h will convert a BIND format zone file into an /etc/hosts style file. It currently only operates on A records. TXT records are used to generate comments.
- -? or --help
Print a brief help message and exit.
Print the complete documentation and exit.
Print the text of the license and exit.
Specify the BIND format zone file to operate on. A resource records are parsed for the IP address and host name. TXT records are matched to generate comments. Multiple zone files can be specified and written to a single host file or an host file per zone file.
The host file that is written to. The default host file is
--multipleis specified, there must be one host file for each zone file given.
- --multiple or --nomultiple
Writes each individual zone file to a separate host file. The negation explicitly writes to single host file; the default behavior.
*** TODO ***
Install Perl and the
DNS::ZoneParse module from CPAN or via PPM. Or
if you are using a binary PAR distribution, just run the executable.
Currently a static Perl format is used to generate nicely aligned columns. The host name is truncated at 20 characters and the comment is truncated at 38 characters.
- Unequal A and TXT record count
DNS::ZoneParsedumps all resource records to an array for each type of record. If each A record does not have a TXT record, the comments will not match properly.
- CNAMEs unhandled
Host files allow multiple host names for each IP address on a single line. Currently CNAME RRs are ignored, but could be parsed into an additional host name.
- Duplicate IPs allowed
If multiple zone files are written to a single host file, there is no check for duplicate IP addresses. If you are starting with a valid BIND configuration, this shouldn't be a problem.
Michael S. Liebman <msl521 at sourceforge dot net>
Copyright 2003 by Michael S. Liebman
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA