Skip to content

Instantly share code, notes, and snippets.

@agramajo
Created April 21, 2015 20:19
Show Gist options
  • Save agramajo/8696ee0a69d26a65945c to your computer and use it in GitHub Desktop.
Save agramajo/8696ee0a69d26a65945c to your computer and use it in GitHub Desktop.
generate reverse zones
@nets = qw(
x.x.x
x.x.y
);
$zone = <<EOF;
\$TTL 1800
@ IN SOA ns1.xxx.com.ar. root.xxx.com.ar. 2014111104 10800 3600 604800 1800
@ IN NS ns1.xxx.com.ar.
@ IN NS webmail.xxx.com.ar.
EOF
open REV, ">db.rev.xxx.com.ar";
print REV "$zone";
foreach $rev (@nets) {
open F, ">db.$rev";
print F "$zone";
$ip = join('.', reverse split(/\./, $rev));
$net = $ip;
$net =~ tr/./-/;
foreach $host (0..255) {
print F "$host 1800 IN PTR host-$host-$net.rev.xxx.com.ar.\n";
print REV "host-$host-$net 1800 IN A $rev.$host\n";
}
close F;
}
close REV;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment