Getting a full list of CNAMEs and A records from DNS

Dave Smith dave at
Fri Dec 7 15:57:24 MST 2007

I have a rather unique problem where I need to construct a full list of 
CNAMEs (aliases) and A records (official names) when given a single host 
name. For example, if foo is a CNAME for bar, and biz is a CNAME for 
baz, and baz is an A record, and I was given "biz", I would want to show 
that "baz" is the primary host, and "foo", "bar", and "biz" are all 
aliases for it.

Is this possible to do with tools like gethostbyname() or some other 
library? Or would this require an entire zone transfer (AXFR)?

So far the only way I've been able to make "dig" do what I want is with 
AXFR, which I'd like to avoid because that requires that my host be 
authorized for zone transfers.



More information about the PLUG mailing list