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 sourceforge.net

;sourceforge.net.       IN  ANY

sourceforge.net.    2390    IN  A
sourceforge.net.    3279    IN  NS  ns-1.sourceforge.com.
sourceforge.net.    3279    IN  NS  ns-1.ch3.sourceforge.com.
sourceforge.net.    3279    IN  NS  ns-2.ch3.sourceforge.com.

ns-2.ch3.sourceforge.com. 3221  IN  A

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...

;sourceforge.net.       IN  ANY

sourceforge.net.    2379    IN  A
sourceforge.net.    3268    IN  NS  ns-1.ch3.sourceforge.com.
sourceforge.net.    3268    IN  NS  ns-2.ch3.sourceforge.com.
sourceforge.net.    3268    IN  NS  ns-1.sourceforge.com.
sourceforge.net.    3597    IN  MX  10 mx.sourceforge.net.

ns-2.ch3.sourceforge.com. 3210  IN  A
mx.sourceforge.net. 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?


  • 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. Sep 2, 2010 at 23:55

1 Answer 1


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 stackoverflow.com @`dig +short  SOA stackoverflow.com | cut -d' ' -f1`

Gives (first time)...

;stackoverflow.com.     IN  ANY

stackoverflow.com.  86400   IN  SOA ns1.p19.dynect.net. jatwood.stackoverflow.com. 2009090960 3600 600 604800 60
stackoverflow.com.  86400   IN  NS  ns3.p19.dynect.net.
stackoverflow.com.  86400   IN  NS  ns2.p19.dynect.net.
stackoverflow.com.  86400   IN  NS  ns4.p19.dynect.net.
stackoverflow.com.  86400   IN  NS  ns1.p19.dynect.net.
stackoverflow.com.  432000  IN  A
stackoverflow.com.  172800  IN  MX  50 aspmx3.googlemail.com.
stackoverflow.com.  172800  IN  MX  10 aspmx.l.google.com.
stackoverflow.com.  172800  IN  MX  20 alt1.aspmx.l.google.com.
stackoverflow.com.  172800  IN  MX  30 alt2.aspmx.l.google.com.
stackoverflow.com.  172800  IN  MX  40 aspmx2.googlemail.com.
stackoverflow.com.  172800  IN  TXT "v=spf1 a mx ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: include:cmail1.com ~all"

Which is exactly the kind of output I need.


  • 1
    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? Sep 3, 2010 at 23:00
  • 1
    to my knowledge Dig isn't supposed to work this way, either. If no server is specified it should be connecting to the default nameserver for the computer.. not using cache at all.
    – apraetor
    Nov 16, 2016 at 14:56
  • Doesn't work if the SOA record has already been cached too. :/ I had to specify a DNS server (e.g. @ to get all the records back.
    – Sinjai
    Jun 9, 2022 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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