Today is: 8 January, 2012
Check todays hot topics

Generate generic Reverse DNS zones

This is useful (probably responsible as well) for owners of large blocks of IP space. This is useful to people who are not you. It's always nice to have forward and reverse resolving ip space even if it's not being used.

In my case we had large net blocks straddling several physical locations. This really helped me locate large blocks and their relative location without having to telnet into network gear and dicking around with all 28347238947238942984 ports feeding our network. It's plenty ghetto. Enjoy.

#!/bin/bash
#Create populated revese zone's for new netblocks 
 
serial=$(date +%Y%m%d)01
        echo "Enter the netblock, without last octet. (example: 72.26.96): "
        read netblock;
        newip=`echo $netblock | sed -e "s/[//.]/-/g"`
        echo "Location Identifier? (example: DTLA or LAX): "
        read location;
        filename="db."$netblock
        #ALTERNATIVELY
        #filename = "${netblock}.zone"
        echo "\$TTL 28800
@               IN      SOA     example.com. dnsmaster.example.com. (
                                $serial         ; serial
                                3600            ; refresh
                                600             ; retry
                                2592000         ; expire
                                3600 )          ; minimum
 
                IN      NS      ns1.example.com.
                IN      NS      ns2.example.com.
 
;
;       $netblock.0-255 Example.com $location 
; " > $filename ;
echo "" >> $filename ;
for i in `seq 1 254`; do echo "$i               IN      PTR     $location-$newip-$i.example.com." >> ./$filename; done