I have a local DNS script that I've inherited from a past employee that needs to compare some values to see if they match specific MX records and IP addresses.
The MX part I have down okay:
120 $doug = doug.local
139 if ($mx_record =~ /$doug/) {
140 print ("Mail on doug.\n");
141 }
142 else {
143 print ("Not on doug.\n");
144 }
$mx_record
is a line from an mx query that would look like this:
thomas. 302 IN MX 10 doug.local.
Now I need to see if the A record matches.
The $a_record
variable from the query looks like this.
thomas. 300 IN A 10.0.0.47
How do I do a conditional statement to match an IP address?
I need to define the IP in a variable and then see if the $a_record
variable contains that defined IP.