#! /bin/bashname=`hostname -f`ip=$(ifconfig eth0 | grep "inet addr" | awk -F '[: ]' '{print $13}')forward=$(host $name | awk -F " address " '{print $2}')reverse=$(host $ip | awk -F "pointer " '{print $2}' | sed 's/\.$//g')if [ "$ip" = "$forward" ]; thenecho -e "Forward Lookup is ok"elseecho -e "\nForward lookup does not match with assigned IP address.IP address is $ip while DNS ponits to $forward."fiif [ "$name" = "$reverse" ]; thenecho -e "\nReverse Lookup is ok"elseecho -e "\nReverse lookup does not match with hostname.Hostname is $name while Reverse DNS ponits to $reverse."fi
Thursday, May 2, 2013
Script to check the Forward/Reverse DNS entries are sane for host
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment