Line | |
---|
1 | #!/usr/bin/perl
|
---|
2 |
|
---|
3 | open STDIN,shift @ARGV
|
---|
4 | or die "Cannot open $_:$!"
|
---|
5 | if @ARGV;
|
---|
6 |
|
---|
7 | while(<STDIN>) {
|
---|
8 | chomp;
|
---|
9 | die "Malformed"
|
---|
10 | unless m/^(\d+)\.(\d+)\.(\d+).(\d+)\s+([\w\-\.]+)$/i;
|
---|
11 | my ($a,$b,$c,$d,$host) = ($1,$2,$3,$4,$5);
|
---|
12 |
|
---|
13 | push @{ $zone{ $a.'.'.$b } }, "$c.$d\tIN PTR\t$host\t; $a.$b.$c.$d";
|
---|
14 | };
|
---|
15 |
|
---|
16 | foreach $z (sort keys %zone) {
|
---|
17 |
|
---|
18 | print <<"ZONE";
|
---|
19 | \$ORIGIN $z.in-addr.arpa.
|
---|
20 | \$TTL 86400
|
---|
21 | @ 1D IN SOA ns1.wLeiden.NET. hostmaster.wLeiden.NET. (
|
---|
22 | $SOA; serial (d. adams)
|
---|
23 | 3H ; refresh
|
---|
24 | 15M ; retry
|
---|
25 | 1W ; expiry
|
---|
26 | 1D ) ; minimum
|
---|
27 | IN NS ns1.wLeiden.NET.
|
---|
28 | IN NS ns2.wLeiden.NET.
|
---|
29 | IN NS ns3.wLeiden.NET.
|
---|
30 | IN NS ns4.wLeiden.NET.
|
---|
31 |
|
---|
32 | ns1 IN A 172.18.8.66 ;tango
|
---|
33 | ns2 IN A 172.17.8.68 ;proxy1
|
---|
34 | ns3 IN A 172.17.143.4 ;proxy2
|
---|
35 | ns4 IN A 172.20.128.98 ;proxy4
|
---|
36 | ZONE
|
---|
37 |
|
---|
38 | foreach $l (@{$zone{$z}}) {
|
---|
39 | print "$l\n";
|
---|
40 | };
|
---|
41 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.