#!/usr/bin/perl #clear the screen! system("clear"); # ask for class b or class c dns file # if class b, ask for third octet of ip range. #$third = "244"; print "\nThis will generate the entries for a reverse lookup file.\n\n"; print "If this is for a Class B reverse file, enter the third octet of the ip address range.\n"; print "If this is for a Class C reverse file, just hit enter.\n"; print "Enter Third Octet>"; $a = ; chop $a; $third = $a; # ask for the last octet of the first ip address #$start = "2"; print "\n\nFor the FIRST IP address, enter the Fourth Octet.\nEnter Fourth Octet>"; $a = ; chop $a; $start = $a; # ask for the last octet of the last ip address #$end = "25"; print "\nFor the LAST IP address, enter the FOURTH Octet. \nEnter Fourth Octet>"; $a = ; chop $a; $end = $a; # ask if the number in the name should match the last octet of the ip address. #$match = 0; $match = 2; print "\nDo you want the number in the hostname to match the fourth octet of the IP address?"; while ($match > 1) { print "\nyes or no>"; $a = ; chop $a; if ($a eq "yes") { $match = 1; } if ($a eq "no") { $match = 0; } } # if no, ask for the first number to use in the names. #$number = 1; if ($match eq 0) { print "\nSince you don't want them to match, what number should I start with?\n"; print "Number>"; $a = ; chop $a; $number = $a; } # ask for a prepend for the names. #$pre = "funky"; print "\nWhat Would you like to prepend the number in the hostnames with?\n"; print "Prepend>"; $a = ; chop $a; $pre = $a; # ask for a postpend for the names. #$post = "wokkawokka.edu"; print "\nWhat Would you like postpend the number in the hostname with? DO NOT enter the domain name here\n"; print "Postpend>"; $a = ; chop $a; $post = $a; # ask for the domain name. print "\nWhat is the Domain Name for the reverse lookup file? No trailing period\n"; print "Hostname>"; $a = ; chop $a; $domain = $a; ############################################################ #End of configuration For Reverse Zone. ############################################################ $fourth = $start; if ( $match ) { $i = $start; } else { $i = $number; } while ( $fourth <= $end ) { if ($third ne "") { print $third, ".", $fourth, "\tin\tptr\t", $pre, "-$i", $post, ".", $domain, ".\n"; } else { print $fourth, "\tin\tptr\t", $pre, "-$i", $post, ".", $domain, ".\n"; } $fourth++; $i++; } #end while ############################################################ print "\n\nEnter the first THREE octets of the IP range\n"; print "FIRST THREE OCTETS>"; $a = ; chop $a; $octets = $a; ############################################################ #End of configuration for Forward Zone. ############################################################ $fourth = $start; if ( $match ) { $i = $start; } else { $i = $number; } while ( $fourth <= $end ) { print $pre, "-$i", $post, "\t\tIN\tA\t", $octets, ".", $fourth, "\n"; $fourth++; $i++; } #end while