Bash script : DNS Check match between reverse and forward lookup

Posted by Rianto Wahyudi

Basic bash lookup script to check if forward / reverse IP address is matching.

  • The script use host command, it'llĀ  automatically add DNS prefix based on /etc/resolv.conf
  • Support for hostnamesĀ  or PTR address with multiple RR
Usage: ./checkhost <IP or hostname> checkhost<IP or hostname> ...
Example: ./checkhost www pop3.iinet.net.au
This script will check if forward and reverse match

./checkhost shadow pop3.iinet.net.au
shadow <-> : Match
pop3.iinet.net.au <-> : Match
mud.starway.net.au <-> : Match

Download the script here :