Validate DNS with nslookup

To validate that the correct DNS entries are in the DNS

Validate script (nsvalidate)

#!/bin/bash
HOSTN=$1
HOSTI=$2
RHOST=`nslookup -type=A $HOSTN|grep Address|grep -v "#53$"|cut -d" " -f2`
if [ $HOSTI != $RHOST ]; then
  echo "Mismatch: $HOSTN expected $HOSTI but returned $RHOST"
fi

Run script

#!/bin/bash
./nsvalidate someserver1 111.111.111.111
./nsvalidate someserver2 222.222.222.222

Table of Contents
QR Code
QR Code tech:linux:dns_validate (generated for current page)