In need of script to compare A records and PTR records

Kurt Boyack kboyack at gmail.com
Thu Aug 4 03:24:46 UTC 2005


On 2 Aug 2005 07:48:17 -0700, bob_a_booie <bob_a_booie at excite.com> wrote:
> Hello
>=20
> Can anybody in the comp.protocols.dns.bind recommend a
> shell script or Perl script that compares
> the A records for a zone
> with the PTR records from the corresponding reverse lookup zone
> and reports mismatches or missing entires ?
>=20

This shell script will do it:

host -l <domain> | grep 'has address' |
while read HOST foo bar IP
do
    host $IP | grep 'not found' > /dev/null
    if [ $? =3D 0 ] ; then
        echo $HOST does not have a PTR record
    else
        PTRHOST=3D`host $IP | awk '{print $5}'`
        if [ "$HOST" !=3D "$PTRHOST" ] ; then
            echo "$HOST does not match $PTRHOST"
        fi
    fi
done



More information about the bind-users mailing list