Menu

#54 Cant get records for ANY

None
closed
nobody
None
5
2019-05-18
2016-01-26
No

Hi, I cant figure out how can I get records for ANY request type.
dig example:
$ dig images.apple.com ANY
...
images.apple.com. 2232 IN CNAME images.apple.com.edgesuite.net.
images.apple.com.edgesuite.net. 12742 IN CNAME images.apple.com.edgesuite.net.globalredir.akadns.net.
images.apple.com.edgesuite.net.globalredir.akadns.net. 2232 IN CNAME a199.dscgi3.akamai.net.
a199.dscgi3.akamai.net. 20 IN A 184.25.56.83
a199.dscgi3.akamai.net. 20 IN A 184.25.56.90
a199.dscgi3.akamai.net. 20 IN CNAME a199.dscgi3.akamai.net.0.1.cn.akamaitech.net.
...

With dnsjava 2.1.7:
Record[] records = new Lookup("images.apple.com", Type.ANY).run();
System.out.println(records.length); // prints 1
for (int i = 0; i < records.length; i++) {
Record rec = records[i];
System.out.println(rec.toString()); // prints single CNAME
}

By the way, if I request A type, I got 2 records. But if I request CNAME, I got only 1 record (but dig returns 2 CNAME records).

Discussion

  • Brian Wellington

    I think there's some misunderstanding about how DNS works.

    The interaction of ANY queries and CNAME records is not particularly well defined. What you're seeing is that the server that dig is querying is following the CNAME, whild dnsjava is returning the CNAME. Both of these are valid behaviors.

    If you don't issue an ANY query (which you shouldn't do, because ANY queries are never a good idea), you'd get a Lookup response with the final A records, and a list of aliases corresponding to the CNAMEs.

     
  • Ingo

    Ingo - 2019-05-18
    • status: open --> closed
    • Group: -->