Digging to the final IP
    Frank Bulk 
    frnkblk at iname.com
       
    Wed Oct 22 03:31:28 UTC 2014
    
    
  
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:dave at 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 <frnkblk at 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 at nagios:/tmp# dig mail.automatedwastesystems.net +short
> 	mail3.sandhills.com.
> 	root at 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
    
    
More information about the bind-users
mailing list