An Introduction to DNS and DNS Tools

The explosive growth of the Internet was made possible, in part, by DNS.
dig (domain information groper)

This powerful command gathers and returns DNS information in a format the name server can use directly. For this reason, dig is particularly useful in scripts. You will find it easy to query specific name servers with dig, making it a useful tool for narrowing down the source of DNS problems.

Suppose you have just transferred your domain name hosting from to A customer sends you an e-mail saying he cannot reach your web site when he is logged into his ISP. You suspect the zone information simply has not had time to propagate. So, you find out what the NS records are for the ISP in question:

dig ns


Then you check your company's web site against the ISP's name servers:


;; ANSWER SECTION:       59m53s IN A
Wait a minute, that is your old IP address. It appears the DNS information has not fully propagated yet.

Next, you decide to see if has removed the old zone information from their name servers. The “any” option will retrieve all the DNS information:

dig any


;; AUTHORITY SECTION:        1H IN NS        1H IN NS

In this case the A record shows your new IP address for your web server, and it shows the new authoritative name servers for your domain name. This is the information you hoped to find.

These are the most useful dig query types: dig any (gathers all DNS information), dig ns (gathers name server information), dig mx (gathers mail exchanger information) and dig a (gathers network address information).

The dig command can also do reverse lookups with output formatted for the zone file:

dig -x
4h11s IN PTR

You can use this tool as a single line command, or you can use it interactively, which distinguishes it from the other DNS commands. Once you have started nslookup, type set all to list the default options. As with dig you can choose the server (name server) you want to query, and you can decide the type of DNS information on which to focus.

Listing 2. Output with nslookup

Just as you can issue commands to nslookup interactively, you can also change the initial defaults by starting a .nslookuprc file. The format of the .nslookup is one command per line:

set type=NS
set timeout=10

The ARPANET (the precursor to the Internet) had a few hundred hosts throughout the 1970s. A single flat file called HOSTS.TXT contained all of the information for every host. System administrators periodically downloaded the file and placed the information into their /etc/hosts file; take a look at your own /etc/hosts to see roughly what that file looked like. However, this system was not scalable. The advent of DNS made the exponential growth of the Internet possible.

Neil Anuskiewicz lives and works in Portland, Oregon. When he is not sitting in front of a computer he likes to hike and climb. Write Neil an e-mail at



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

DNS server performance

Lukas's picture

For those of you, who don't just wanna make sure their dns system works properly but who are also interested in how fast their dns provider is, you can check your speed with this dns lookup tool.