Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!think.com!yale!ox.com!emv From: hakanson@ogicse.ogi.edu (Marion Hakanson) Newsgroups: comp.archives Subject: [comp.protocols.tcp-ip.domains] Re: How to create /etc/hosts from zone Keywords: hosts Message-ID: <1990Nov17.060543.24593@ox.com> Date: 17 Nov 90 06:05:43 GMT References: <19523@oolong.la.locus.com> <1667@devildog.att.com> <1990Nov15.185211.876@hemel.bull.co.uk> <1990Nov16.150818.5844@ssd.kodak.com> <14092@ogicse.ogi.edu> Sender: emv@ox.com (Edward Vielmetti) Reply-To: hakanson@ogicse.ogi.edu (Marion Hakanson) Followup-To: comp.protocols.tcp-ip.domains Organization: Oregon Graduate Institute (formerly OGC), Beaverton, OR Lines: 46 Approved: emv@ox.com (Edward Vielmetti) X-Original-Newsgroups: comp.protocols.tcp-ip.domains Archive-name: dnsparse/16-Nov-90 Original-posting-by: hakanson@ogicse.ogi.edu (Marion Hakanson) Original-subject: Re: How to create /etc/hosts from zone Archive-site: cse.ogi.edu [129.95.10.2] Archive-directory: /pub Reposted-by: emv@ox.com (Edward Vielmetti) In article <1990Nov16.150818.5844@ssd.kodak.com> sloey@ssd.kodak.com (Jim Sloey (253-7956)) writes: >. . . >I tried this [converting /etc/hosts to dns] > for a while about 3 years ago, but found there was no way to >keep MX, WKS, and HINFO fields updated without forcing structured comments >into the host file. >Instead I wrote a shell program (makehosts) to create hosts from domain data >using nslookup and zone transfers. It is called from an editor (vins) which >locks the file and updates the serial field like vipw, then creates a new host >table using HINFO for the comments. >Unfortunately, I left out the CNAMES, so my program won't help you much. I agree with taking the approach that the DNS files should be the master database, and that one should produce /etc/hosts files from them (if necessary). I have not studied the recently-posted perl conversion script, but I did spend a lot of effort some time ago to produce one of my own. Actually, it is a hybrid, using a C program to pre-process the master files into a canonical form easily digested by Perl. There's a Perl subroutine called "dns_getrr()" which returns the next resource-record from the master file, and I have a few other scripts which use this subroutine. There's a simple one to automatically generate PTR records from A records, and there's a very involved one which produces /etc/hosts files. The latter is pretty fancy, including CNAME's, and best of all (in my opinion), it produces a hosts file which mimics the action of the BIND resolver in tacking on default domains to short aliases (in almost all cases). In other words, your /etc/hosts file will behave exactly like a DNS resolver, in all three directions (name-to-number, number-to-name, and alias-to-FQDN). It's not perfect, and it's not for everybody, but it works pretty well here, and it doesn't exercise any DNS servers to do its job. I call it the dnsparse kit, version 2.0. You can retrieve it via anonymous FTP to host cse.ogi.edu, file pub/dnsparse-2.0.tar.Z. -- Marion Hakanson Domain: hakanson@cse.ogi.edu UUCP : {hp-pcd,tektronix}!ogicse!hakanson