jj@dcs.leeds.ac.uk (J Jackson) (04/10/91)
Has anybody an off-the-shelf script of program that will read an /etc/hosts file and create the database fileformat required by the named daemon? cheers ======================================================================= Jim Jackson Email : School of Computer Studies UK - JANET : jj@uk.ac.leeds.dcs Leeds University Internet : jj@dcs.leeds.ac.uk Leeds LS2 9JT UK Phone : +44 532 335451 ======================================================================= Opinions! What Opinions? I just wield the brush round here.
logier@cheops.qld.tne.oz.au (Rob Logie) (04/12/91)
jj@dcs.leeds.ac.uk (J Jackson) writes: >Has anybody an off-the-shelf script of program that will read an >/etc/hosts file and create the database fileformat required by the >named daemon? >cheers >======================================================================= >Jim Jackson Email : >School of Computer Studies UK - JANET : jj@uk.ac.leeds.dcs >Leeds University Internet : jj@dcs.leeds.ac.uk >Leeds LS2 9JT >UK Phone : +44 532 335451 >======================================================================= > Opinions! What Opinions? I just wield the brush round here. I was faced with a similar problem on my network, but fortunalty I have a few HP9000 running HP-UX 7.0, which just happerns to have a function that does what you want. It will even produce config files for non-HP machines if you throw that right parameters at it (I manage the configuration on a Pyramid MIS with it. Have a look around you network to see if there is a HP9000, and that will solve your problem. Email me if you want more info on how to do it. Regards -- Rob Logie EMAIL: logier@cheops.qld.tne.oz.au Telecom Australia FAX: +61 7 837 4704 TNE Computer Support Services PH: +61 7 837 5174 Brisbane Office "These are my opinions alone"
Andy.Linton@comp.vuw.ac.nz (Andy Linton) (04/12/91)
In article <1991Apr11.220839.17490@cheops.qld.tne.oz.au>, logier@cheops.qld.tne.oz.au (Rob Logie) writes: |> I was faced with a similar problem on my network, but fortunalty I have a |> few HP9000 running HP-UX 7.0, which just happerns to have a function |> that does what you want. What is it called????
brian@ucsd.Edu (Brian Kantor) (04/12/91)
1 each stupid awk script that handles 90% of our needs for conversion of hosts table to domain database format: /^#/ {print "; "$0;next} /^$/ {next} { split($2,hn,"."); printf("%s\tIN\tA\t%s\n", hn[1], $1); for(i=3; i< 9; i++) { if (!$i) break; split($i,nn,"."); if (hn[1] != nn[1]) printf("%s\tIN\tCNAME\t%s\n", nn[1], hn[1]); } }
echan@cadev6.intel.com (Eldon Chan ~) (04/12/91)
IBM RS6000 running AIX 3.1 has such scripts build in too. They are pretty small scripts, it should work on most UNIX. Eldon Chan ------------------------------------------------------------------------ From tcp-ip-RELAY@NIC.DDN.MIL Fri Apr 12 02:37:12 1991 Received: by scdt (5.57/10.0i); Fri, 12 Apr 91 02:37:08 PDT Received: by hermes.intel.com (5.57/10.0i); Fri, 12 Apr 91 02:22:24 PDT Received: from ucbvax.Berkeley.EDU by NIC.DDN.MIL with TCP; Thu, 11 Apr 91 17:17:51 PDT Received: by ucbvax.Berkeley.EDU (5.63/1.42) id AA28297; Thu, 11 Apr 91 17:07:36 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for tcp-ip@nic.ddn.mil (tcp-ip@nic.ddn.mil) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 11 Apr 91 22:08:39 GMT From: uhccux!munnari.oz.au!brolga!bunyip.cc.uq.oz.au!cheops!logier@ames.arc.nasa.gov (Rob Logie) Organization: Telecom Australia, TNE Computer Support Services Subject: Re: Wanted: /etc/hosts to DNS (rfc1035) format conversion program Message-Id: <1991Apr11.220839.17490@cheops.qld.tne.oz.au> References: <7571.9104101607@csunb0.dcs.leeds.ac.uk> Sender: tcp-ip-relay@nic.ddn.mil To: tcp-ip@nic.ddn.mil Status: R jj@dcs.leeds.ac.uk (J Jackson) writes: >Has anybody an off-the-shelf script of program that will read an >/etc/hosts file and create the database fileformat required by the >named daemon? >cheers >======================================================================= >Jim Jackson Email : >School of Computer Studies UK - JANET : jj@uk.ac.leeds.dcs >Leeds University Internet : jj@dcs.leeds.ac.uk >Leeds LS2 9JT >UK Phone : +44 532 335451 >======================================================================= > Opinions! What Opinions? I just wield the brush round here. I was faced with a similar problem on my network, but fortunalty I have a few HP9000 running HP-UX 7.0, which just happerns to have a function that does what you want. It will even produce config files for non-HP machines if you throw that right parameters at it (I manage the configuration on a Pyramid MIS with it. Have a look around you network to see if there is a HP9000, and that will solve your problem. Email me if you want more info on how to do it. Regards -- Rob Logie EMAIL: logier@cheops.qld.tne.oz.au Telecom Australia FAX: +61 7 837 4704 TNE Computer Support Services PH: +61 7 837 5174 Brisbane Office "These are my opinions alone"
ian@unipalm.uucp (Ian Phillipps) (04/19/91)
jj@dcs.leeds.ac.uk (J Jackson) writes: >Has anybody an off-the-shelf script of program that will read an >/etc/hosts file and create the database fileformat required by the >named daemon? This updates the version number automatically. I run it from a make file in /etc on our host. I just noticed that I hard-coded the name (diamond) of our primary server. Yechhh... ----cut here and put in your domain/network address---- /usr/local/bin/perl <<'END_SCRIPT' # This script takes the /etc/hosts file, and makes up copies of host->name (named.net) and name->host (named.db) tables # $_ =`grep 'serial number' /etc/named.db`; $major=1; $minor=1; if ( /([0-9]+)\.([0-9]+).*;.*serial number/ ) { $major = $1; $minor = $2 + 1; } $zone = "unipalm.co.uk"; $net = '192\.9\.200'; open( db, '>/etc/named.db' ) || die; open( net, '>/etc/named.net' ) || die; open( stdin, '/etc/hosts' ) || die; print db "@ IN SOA $zone. diamond.$zone. ( $major.$minor ; serial number 7200 ; refresh every two hours 7200 ; retry every two hours 12096000 ; expire in twenty weeks 86400 ) ; time-to-live IN NS diamond.$zone. "; print net "@ IN SOA $zone. diamond.$zone. ( $major.$minor ; serial number 7200 ; refresh every two hours 7200 ; retry every two hours 12096000 ; expire in twenty weeks 86400 ) ; time-to-live IN NS diamond.$zone. $zone. IN MX 0 mailhost.$zone. IN A 192.9.200.5 "; while( <> ) { next unless /^192\.9/; s/#.*$//; ($number,$name,@alias)=split; ($net1,$net2,$net3,$net4)=split(/\./, $number ); print db "$name\tIN\tA\t$number\n"; print net "$net4\tIN\tPTR\t$name.$zone.\n" ;#if $number =~ /[^0-9]192\.9\.200\./; #if $number =~ /[^0-9]$net\./; while( $alias=pop alias ) { print db "$alias\tIN\tCNAME\t$name\n"; } } END_SCRIPT