Script to creat PTR zone from zone file

big bond bondarets at gmail.com
Mon Nov 1 11:03:47 UTC 2010


Doh! I've sent a wrong version of script, with errors. Here's a correct one:

#!/bin/bash
NET=192.168.111
HOST=example.com
LIMIT=254
    for ((i=1;i<= LIMIT ; i++))
        do
            IP=`echo $NET.$i`
            ARPA=`host $NET.$i | awk '{print $5}'`
            FIRSTOCT=`echo $IP $ARPA | grep NX | awk '{print $1}' | cut -d .
-f1`
            SECOCT=`echo $IP $ARPA | grep NX | awk '{print $1}' | cut -d .
-f2`
            THIRDOCT=`echo $IP $ARPA | grep NX | awk '{print $1}' | cut -d .
-f3`
            LASTOCT=`echo $IP $ARPA | grep NX | awk '{print $1}' | cut -d .
-f4`
            PTR=`echo host$LASTOCT.$THIRDOCT.$SECOCT.$FIRSTOCT.$HOST | grep
-v 't\.'`
            echo $LASTOCT.$THIRDOCT.$SECOCT.$FIRSTOCT.in-addr.arpa.    IN
PTR    $PTR.  | egrep -v '^\.'
        done


2010/11/1 big bond <bondarets at gmail.com>

> Sorry, first message was sent not for the list but to Alan only. (by the
> way, why "reply" button does not send message to list by default?)
>
> 2010/10/30 Alan Clegg <aclegg at isc.org>
>
>> On 10/30/2010 1:42 AM, Sukman wrote:
>>
>> >> Looking to write a script to create the PTR records..
>> >> Not much on the Web..
>> >
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20101101/cc93d693/attachment.html>


More information about the bind-users mailing list