Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was playing about with 'dig' showing a friend how it worked when I spotted some odd behaviour with the 'any' type.

I believe that using 'dig any' will get all the record types automatically but that doesn't seem to be happening for some reason.

Here's my output...

; > DiG 9.4.3-P3 > ANY

;       IN  ANY

;; ANSWER SECTION:    2390    IN  A    3279    IN  NS    3279    IN  NS    3279    IN  NS


Notice how its missing the MX records? So that I ran "dig MX" and got the MX records just fine. So I decided to run 'dig any' again to check that I wasn't go mad and I got the following results...

;       IN  ANY

;; ANSWER SECTION:    2379    IN  A    3268    IN  NS    3268    IN  NS    3268    IN  NS    3597    IN  MX  10

;; ADDITIONAL SECTION: 3210  IN  A 1653    IN  A

And now the MX records show up!

Any idea what is going on? How do I make it actually show all the records first time?


share|improve this question
Can you reproduce this on another machine, by querying a different server, or at another time (when enough caches have expired)? DNS is not reliable, so I suspect a glitch somewhere (e.g. a lost packet, or a delayed packet that was not waiter for), probably at sourceforge's DNS provider since after that the information should be in a single UDP packet. – Gilles Sep 2 '10 at 23:55

OK, I worked out what the problem is. When I run 'any' normally it takes its results from my local cache, so it will only display the records that I have already 'seen'.

To bypass this and retrieve all the records correctly I have to direct my query to the authoritative name server for that domain.

Here's the one-liner I'm now using to do it...

dig any @`dig +short  SOA | cut -d' ' -f1`

Gives (first time)...

;     IN  ANY

;; ANSWER SECTION:  86400   IN  SOA 2009090960 3600 600 604800 60  86400   IN  NS  86400   IN  NS  86400   IN  NS  86400   IN  NS  432000  IN  A  172800  IN  MX  50  172800  IN  MX  10  172800  IN  MX  20  172800  IN  MX  30  172800  IN  MX  40  172800  IN  TXT "v=spf1 a mx ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ~all"

Which is exactly the kind of output I need.


share|improve this answer
I don't know much about DNS, but I don't think your local cache is supposed to behave this way. What software is it? – Gilles Sep 3 '10 at 23:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.