#!/bin/bash # change this to your dns resolver/cache server DNS_IP=a.b.c.d # the domain hint should be your ns servers # if you have more than one your domain name # should be sufficient DOMAIN_HINT="domainname" # the network hint should be the network your # nameservers belong to NETWORK_HINT="192.168.0" # the following should be a list of exported domains # one per line NAMES=`cat named-export.txt` for i in $NAMES do RESULT=`dig @$DNS_IP -t NS $i +short` if D=`echo $RESULT | grep -v $DOMAIN_HINT`; then NS=`echo $RESULT | head -n 1` E=`dig -t A $NS +short`; if D=`echo $E | grep -v $NETWORK_HINT`; then echo $i; fi fi done