Conversion from /etc/hosts to x.hosts and x.rev

Bill Larson wllarso at swcp.com
Wed May 17 16:12:27 UTC 2006


On May 17, 2006, at 2:53 AM, Stefan Wolber wrote:

> Currently I am trying to tidy up my servers a little bit. Part of the
> project is the merging of /etc/hosts files from each server into one 
> general
> dns server. Therefor I would like to convert the /etc/hosts files into 
> a
> mydomain.hosts file and a my_ip_numbers.rev file.
>
> This must be a more common problem and not only be limited to me but I
> searched the internet for hours, including the mail archives of this 
> group,
> but could not find scripts or programs that allow me to do that.
>
> Can you point me into the right direction?

How about looking in the "DNS and BIND" book.  Cricket wrote a tool in 
Perl called "h2n" which does EXACTLY this, converting the contents of 
/etc/hosts into forward and reverse zone files.  "h2n" is available 
from the O'Reilly web site as the examples from the book.  An Internet 
search should also return links to it too.

Anyone that is running a DNS server needs to get a copy of "DNS and 
BIND".  It is ***the*** bible for understanding, operating, and 
administering a DNS operation under BIND.  The current edition is the 
4th, but the 5th edition will be coming out towards the end of this 
month.  The 5th edition will cover BIND 9.3.2 and should be well worth 
the cost of a new copy, but the 4th edition is very useful too.

Anyway, save yourself the trouble of searching the Internet and the 
mail archives.  Get a copy of this book.  It will save you lots of 
time, effort, and frustration.

Bill Larson



More information about the bind-users mailing list