Digging to the final IP
    Dave Knight 
    dave at knig.ht
       
    Wed Oct 22 01:20:53 UTC 2014
    
    
  
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20141021/a38937d4/attachment.bin>
    
    
More information about the bind-users
mailing list