How are "nslookup," "dig," and "host" different (in terms of looking up hostnames or IP addresses)? Which authorities are queried? I'm trying to figure out when I should use one over the others.

4 Answers 4


The comments that the tools are all the same is wrong. Host/dig work essentially the same way, but nslookup does several undesirable things. The following page provides a good explanation of the flaws with nslookup.


They aren't massively different - They're all tools to query DNS. Nslookup is mostly deprecated in favour of dig. I personally consider host easiest to use but dig is more flexible.


They should all do lookups the same way, and when you ask the same question, they should all give you the same answer.

If you don't specify a name server all of them should use whatever resolvers you have defined on your system as their starting point.


As far as what authorities are queried, the tools usually default to your operating system's DNS settings - Network control panel / DNS in windows, and /etc/resolv.conf in UNIX.

This is only part of the story of course; it can be useful to query at a few different levels:

  • Your office DNS server (if you have one)
  • Your upstream ISP's DNS server
  • Your hosting facility's DNS server (if relevant)
  • The authoratative DNS server for the zone (DNS provider)

It's also smart to combine this with the whois tool.

There have been many situations where I've seen office DNS servers, and even a company's upstrem DNS server cache "bad" old information for longer than you want - but if you query around you will find that the DNS is set up properly.

This usually ends up in the unfortunate situation where you try to explain to your boss "No, no, we're not down. It's just that our office can't see our web site, I swear most everyone else in the world can."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .