Dave,

Thanks for the input, but what I was looking for was a dig command that
returns the IP(s) or a fail.  It looks like the host command is the right
solution in this case, not dig.

Kind regards,

Frank

-----Original Message-----
From: Dave Knight [mailto:d...@knig.ht] 
Sent: Tuesday, October 21, 2014 8:21 PM
To: Frank Bulk
Cc: bind-users
Subject: Re: Digging to the final IP

On Oct 19, 2014, at 1:26, Frank Bulk <frnk...@iname.com> wrote:

> Is there a dig option that will list out the final (IPs) or query result??
> By default, even with +short, it can list intermediate CNAME(s) and not
what
> IP(s) that CNAME may have.  
> 
> For example, 
>       root@nagios:/tmp# dig mail.automatedwastesystems.net +short
>       mail3.sandhills.com.
>       root@nagios:/tmp#
> 
> I'd rather know that mail3.sandhills.com is NXDOMAIN.
> 
> Regards,
> 
> Frank


How about. 

$ dig +noall +answer mail.automatedwastesystems.net in a | egrep 'IN\tA\t' |
cut -f6

which correctly returns nothing in this case, but when there's a CNAME chain
ending in addresses it returns them

$ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
216.235.14.46

and surely you want IPv6 support.

$ dig +noall +answer dave.knig.ht in a dave.knig.ht in aaaa | egrep
'IN\t(A|AAAA)\t' | cut -f6
216.235.14.46
2001:4900:1:393::2

dave

_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to