Quick hack to populate a bind reverse zone file for RFC1918

From Ye Ole Stash
Jump to: navigation, search
#!/bin/bash
a=0
 
while [ $a -lt 254 ]; do
    a=$(($a+1))
    for d in $(cat /var/named/rev/1.168.192.IN-ADDR.ARPA| grep PTR | egrep [1-99] | awk '{print $1}');do
        if [ "$d" == "$a" ]; then
            echo "$d is already there" && continue 2;
                fi
       done
    echo "$a                       PTR     $a.1.168.192.in-addr.80sretro.com. "  >>/var/named/rev/1.168.192.IN-ADDR.ARPA
done
Personal tools