Developer

Explaining that mysterious DNS

Sometimes it's best to go back to the basics and examine how things work. In this Daily Feature, Bryan Pfaffenberger explains what the domain name service does.


Why not configure your own DNS server? It's easy—and what's more, you'll see a big payoff in the increased speed with which you can access the Web. Here's a conceptual introduction to the domain name service (DNS); in future Daily Features, you'll learn how to configure Windows 2000 and Linux so that they provide DNS services locally.

IP addresses
Viewed from the computer's perspective, the Internet is a vast field of numerical addresses—the so-called "dotted quad" addresses (such as 64.58.76.177) that you sometimes see when you're filling out information in network configuration dialog boxes. What you're seeing is an IP address, a 32-bit number that precisely identifies the location of a specific computer on the Internet. Generally, people don't like working with such numbers. For one thing, the numbers are hard to remember. What's more, the data you're looking for might move from one computer to the next. If you had to work with nothing but numerical IP addresses, using the Internet wouldn't be much fun. You'd have to keep track of lots of hard-to-remember IP addresses, and you'd have to keep your list updated so that you could locate the data you needed when its physical location changed. That's precisely why the Domain Name System was invented.

In brief
In brief, the Domain Name System creates a human-friendly nomenclature for identifying Internet locations. In the example www.techproguild.com, for instance, the first part—www—is the name of a specific network location within the techproguild.com domain—and as you probably know, it's a "dot-com" domain because of the "com" appended to the name. A numerical IP address is still needed to access www.techproguild.com, however. How does your Web browser obtain this address?

DNS explained
The domain name service (DNS) takes care of translating between human-friendly names (such as www.techproguild.com) and those pesky numerical addresses. When you access the Internet, you fill out a networking dialog box that specifies the IP address of your service provider's DNS server, which lists the location of a given site in its massive, memory-based cache of linked domain names and IP addresses (or it knows how to ask another DNS server how to obtain the needed information). When you use your Web browser and click on an address such as http://www.techproguild.com, your Web browser contacts the DNS server you've configured, submits the domain name information (www.techproguild.com), and receives the IP address in reply. Your browser then uses the numerical IP address to access TechProGuild.

The DNS solves both of the major problems that existed before it was invented. First, it gives users a way of remembering specific Internet locations that's much better than using numerical IP addresses. Second, it enables Internet content providers to move data around without requiring every Internet user to memorize a new IP address. This is accomplished by means of domain name registration, a process in which an independent, third-party agency keeps track of the relationship between user-friendly domain names (such as www.techproguild.com) and IP addresses (such as 64.58.76.177). Should TechProGuild decide to move its home page to a different location, it's easily done; the company contacts the registration agency and notifies the agency of the change. Meanwhile, certain authoritative DNS servers propagate the new address throughout the network so that, within a few hours, the whole Internet "knows" the new location.

If you're using Windows 2000, Linux, or UNIX, you can communicate with a DNS server without the aid of a Web browser. In Windows 2000, open a command window; in Linux or UNIX, launch a terminal window within X. Now type nslookup www.techproguild.com and press [Enter]. The nslookup utility contacts the DNS server you've configured, obtains the IP addresses currently associated with this domain (as you'll see, there's more than one of them), and reports those addresses to you. Pretty cool, huh? (You need to be connected to the Internet in order for this command to do its trick.)

Now try accessing a new Web site—one that you haven't yet visited today—with your Web browser, and keep your eye on your browser's status line. You'll see that the process of accessing this site is indeed a two-step affair. In Internet Explorer, you'll first see the message Finding Site.... In this phase, the browser is contacting the DNS server to obtain the site's IP address. When the browser locates the address, you'll see the message Web Site Found. At this point, the browser uses the numerical IP address to request the Web page you're after. You don't see the numerical IP address, but you do see the message Opening Page... followed by Done. Try this a few more times, but always with sites you haven't yet accessed; if you redisplay a site you've already visited today, your browser will retrieve the page from its local cache, not the Internet, so the two-step process doesn't occur. But for the new sites, it's strictly one-two, one-two—and it's time consuming.

The time required to perform both of these steps (obtaining the numerical IP address from the DNS server and then requesting the page) starts to seem inordinately lengthy when you're accessing the Internet by any kind of dial-up connection. Why not cut one of these steps out completely? Technically, it's not that difficult to configure any reasonably capable, server-oriented operating system (such as Windows 2000 or Linux) to run a DNS server, and there's a huge payoff for doing so. Because you're running the server locally, your Web browser (as well as other Internet utilities) does not always have to go out to the network to retrieve the numerical IP address you need. The more you use your local DNS server, the more IP addresses it learns, until you get to a point that almost all of the sites you accessed can be obtained by contacting the local server. The result is what appears to be significantly faster Internet access—and believe me, you'll love it.

In future Daily Features, I'll take a quick look at the essentials of setting up your own DNS server on the two leading server operating systems for PCs: Windows 2000 and Linux. Until then, keep your eye on your Web browser's status line—and think about how much time you'll save when you've eliminated one step of the site-accessing process.
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Editor's Picks