Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!spool.mu.edu!snorkelwacker.mit.edu!stanford.edu!csli!gandalf From: gandalf@csli.Stanford.EDU (Juergen Wagner) Newsgroups: comp.protocols.tcp-ip.domains Subject: Re: Building /etc/hosts from DNS anyone? Message-ID: <19763@csli.Stanford.EDU> Date: 10 Jun 91 07:36:44 GMT References: <9106052021.AA29681@mickey.ycc.yale.edu> <9106062020.AA00536@tsx-11.MIT.EDU> Distribution: inet Organization: Center for the Study of Language and Information, Stanford U. Lines: 42 A short shell script for creating /etc/hosts from the name server data base by using nslookup for the zone transfer can be found on ftp.iao.fhg.de in pub/zone (available via anonymous ftp). A few assumptions are made by this script: [1] `domainname` returns the current machine's domain suffix. This domain and its parent are listed by default. [2] The argument list of 'zone' specifies additional domains to include in /etc/hosts. [3] /usr/local/bin/nslookp allows invocations of the form nslookup -query=ns $zone [4] All host names included in /etc/hosts are written lowercase. [5] /var/domain/Registrar/hosts.fixes contains local additions not found in the name server download. The resulting file looks like # # Zone dump of Sun Jun 9 23:30:08 MET DST 1991 # Created by zonedump utility on apatix by root. # 127.0.0.1 localhost loghost # #+ Zone caed.iao.fhg.de from master apatix.iao.fhg.de (version 9106033) #+ Zone bit.iao.fhg.de from master apatix.iao.fhg.de (version 9105143) #+ Zone ergo.iao.fhg.de from master apatix.iao.fhg.de (version 910426) #+ Zone ie.iao.fhg.de from master apatix.iao.fhg.de (version 9105142) #+ Zone iao.fhg.de from master apatix.iao.fhg.de (version 9105231) # 129.69.1.105 golden-gateway golden-gateway.iao.fhg.de 129.69.133.1 obelix obelix.iao.fhg.de iaoobelix iaoobelix.iao.fhg.de 129.69.133.10 comix comix.iao.fhg.de 129.69.133.40 decefix decefix.iao.fhg.de 129.69.234.200 comix comix.iao.fhg.de .. ... The 'zone' script handles aliases and multiple host interfaces. It also includes the version numbers to be able to distribute the new hosts file only if changes occurred. --Juergen Wagner (gandalf@csli.stanford.edu, wagner@iao.fhg.de)