source: genesis/dns/rev2revzone.pl@ 3771

Last change on this file since 3771 was 3125, checked in by dirkx, 20 years ago

SOA numbers

File size: 1.3 KB
Line 
1#!/usr/bin/perl
2
3# Contruct Serial - max of roughly 99 per day;i.e. one
4# every 3 minutes.
5#
6my ($y,$m,$d,$H,$M) = (gmtime(time))[5,4,3,2,1];
7my $SOA = sprintf("%04d%02d%02d%02d", 1900+$y, $m, $d, int(100*($H*60+$M)/(24*60)));
8
9open STDIN,shift @ARGV
10 or die "Cannot open $_:$!"
11 if @ARGV;
12
13while(<STDIN>) {
14 chomp;
15 die "Malformed"
16 unless m/^(\d+)\.(\d+)\.(\d+).(\d+)\s+([\w\-\.]+)$/i;
17 my ($a,$b,$c,$d,$host) = ($1,$2,$3,$4,$5);
18
19 push @{ $zone{ $a.'.'.$b } }, "$c.$d\tIN PTR\t$host\t; $a.$b.$c.$d";
20};
21
22foreach $z (sort keys %zone) {
23
24 print <<"ZONE";
25; Autmatically generated zone file
26;
27\$ORIGIN $z.in-addr.arpa.
28\$TTL 86400
29@ 1D IN SOA ns1.wLeiden.NET. hostmaster.wLeiden.NET. (
30 $SOA; serial
31 3H ; refresh
32 15M ; retry
33 1W ; expiry
34 1D ) ; minimum
35 IN NS ns1.wLeiden.NET.
36 IN NS ns2.wLeiden.NET.
37 IN NS ns3.wLeiden.NET.
38 IN NS ns4.wLeiden.NET.
39
40ns1 IN A 172.18.8.66 ;tango
41ns2 IN A 172.17.8.68 ;proxy1
42ns3 IN A 172.17.143.4 ;proxy2
43ns4 IN A 172.20.128.98 ;proxy4
44ZONE
45
46 foreach $l (@{$zone{$z}}) {
47 print "$l\n";
48 };
49};
Note: See TracBrowser for help on using the repository browser.