Server Fault is a question and answer site for system and network administrators. 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

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.

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.