A lockfile is stuck; please send me e-mail to let me know.

How DNS Works

Tuesday, February 6th, 2001

Several people have asked me for information about how to register a domain name and set up a Web site, and it occurred to me that if I put this article together I wouldn't have to keep explaining things over and over. Since I've been running my own Web and DNS server for well over a year and am hosting several domains, people seem to think I'm qualified to answer these sorts of questions. However, it's only fair to let you know that I'm not really an expert on this, and some of my descriptions and explanations will be oversimplified.

If you're going to register a domain, it's really a good idea to understand the basics of how DNS works, so you can understand what services you need in order to get your Web site up and running and, when the bill arrives, understand exactly what you're paying for. Unfortunately, this is actually somewhat complicated. I'll start by explaining what DNS does and how domains work, then go over the process of actually registering a domain, and finally touch on what you have to do to get your domain hosted. I will not cover building a Web site or setting up e-mail; there's plenty of other material available on those subjects. I also won't cover setting up your own DNS server, although I may tackle that later.

Why DNS?

Every computer on the Internet has a unique numerical address assigned to it called an IP address. Every server has one, and when you connect to the Internet, your computer gets one too. If you connect to the Internet by dialing out with a regular modem and a phone line, your ISP (Internet Service Provider) is probably assigning you a different IP address every time you connect. An IP address that is always the same is called static, while one that changes whenever you connect is called dynamic. Servers generally have static IP addresses, because in order to connect to a server, you need its current IP address, and it's much easier if you don't have to worry about it changing.

Being fundamentally stupid creatures, computers can only find each other on the Internet by using this numerical address - just like you can only call someone on the telephone by dialing their phone number. We humans, however, have a great deal of trouble remembering long strings of numbers that all seem to look the same - we find names to be much easier. This is where DNS, the Domain Name System, comes in.

DNS makes it possible to enter a name (for example, www.webwizardry.net) into your Web browser when you want to get to a Web site. Before it can access the site, your computer simply asks a DNS server (also called a nameserver) for the IP address associated with that name (in this case, Your computer can then connect to the correct server and retrieve the Web site you wanted. Using a DNS server is like calling Information: you give them the name of the person you're trying to call, and they give you the person's phone number. On the Internet, you give a DNS server the name of a computer you're trying to connect to, and it gives you the IP address.

How does your computer know which DNS servers to ask? Simple: you tell it. Or someone else does. When you set up your Internet connection, you either put the IP addresses of a couple of DNS servers into your computer, or you installed software that did it for you. If you're curious, you can check to see which DNS servers your computer is set to use. In Windows 95/98, click Start, Run, type winipcfg and press Enter, click “More Info” and look at the line that says “DNS Servers”. In Mac OS 7.5 and later with Open Transport, go to the Apple menu, Control Panels, TCP/IP, and look in the “Name server addr.” box. In Linux or UNIX, look for lines starting with “nameserver” in the /etc/resolv.conf file.


Let's get a few terms out of the way.

Top level domain: A top level domain, or TLD, is the very last part of a domain name. The most well-known TLD is .com, for commercial businesses, but there's also: Those are called generic top level domains, or gTLDs. Additionally, every country has its own two-letter country code top level domain, or ccTLD, that it can use as it pleases. For example:
Hostname: This is the name of a computer, usually the name of a server. Frequently, servers that perform certain common functions are given standard names according to convention (www for a Web server, ftp for an FTP server, mail for an e-mail server, ns1 and ns2 for primary and secondary DNS servers respectively, etc.). However, this is only convention; there's no rule about what your hostnames have to be. Mindspring's DNS servers are named itchy and scratchy, which I personally think is very cool.

Fully Qualified Domain Name (FQDN): This is a long annoying term that just means the combination of a hostname and a domain, such as www.ibm.com, bbs.ufies.org, www.apple.co.jp, mail.webwizardry.net, etc. It's also possible for a domain name to also be a FQDN; you aren't required to have a separate hostname. For example, phroggy.com is a FQDN by itself, although www.phroggy.com is another FQDN that points to the same IP address.

Nameserver: Another name for a DNS server. It takes a name, finds the IP address associated with that name, and gives you the IP address.

Authoritative: A DNS server that's registered as being responsible for knowing the contents of a domain. For example, ns2.slickhosting.com is one of the DNS servers that's authoritative for webwizardry.net, because it's listed as one of the DNS servers on the webwizardry.net domain registration.

Root nameserver: One of the thirteen DNS servers scattered around the globe that are responsible for knowing what servers are authoritative for the various top level domains. The master root nameserver, a.root-servers.net, is operated by Network Solutions, and broadcasts all its information to the other twelve root namservers.

Generic TLD server: Like the root nameservers, these are scattered around the globe and Network Solutions operates a.gtld-servers.net. The gTLD servers are authoritative for the .com, .net, .org, .edu domains, and possibly others as well (I'm not entirely sure).

Registrar: The company that you can register a domain through. This is the company that takes your money when you register, and is who you contact if you need to make any changes to your registration information (such as switching to different authoritative DNS servers). This is not the company that you give the IP address of your Web server to!

Tracing a DNS Query

Let's say your computer needs to know the IP address for www.webwizardry.net. It asks your DNS server, and your DNS server doesn't know. Here's what happens:

  1. Your DNS server asks one of the root nameservers who's responsible for the .net top level domain. The root nameserver responds with a list of gTLD servers.

  2. Now your DNS server talks to one of the gTLD servers, and asks who's in charge of webwizardry.net. The gTLD server responds with the list of nameservers that are listed on the domain registration for that domain.

  3. Your DNS server then picks one of the nameservers that are listed on the domain registration - say, ns2.slickhosting.com - and asks, “Hey, do you know who www.webwizardry.net is?” It then gets the IP address, and sends it back to your computer.

  4. Your computer now has the IP address,, and it establishes an HTTP connection with the Web server at that IP address and requests the Web page. (HTTP stands for HyperText Transfer Protocol, and is the language Web browsers and Web servers use to talk to each other.)

Registering a Domain Name

Here's the part you've been waiting for: registering a domain name. The first thing you need to do is choose a registrar.

In 1992, the National Science Foundation appointed Network Solutions as the only registrar that could register .com, .org and .net domains. In 1998, the Clinton Administration created the Internet Corporation for Assigned Names and Numbers (ICANN) to oversee domain name and IP address registrations, and in 1999, ICANN opened the market for registration of the .com, .org and .net domains up to competition. The complete, official list of .com, .org and .net registrars is here, and the list of ccTLD registrars is here.

You may want to check out the Domain Name Buyer's Guide, which gives a comparison of some of the larger registrars. The Domain Name Buyer's Guide does not include CORE and OpenSRS, which are domain wholesalers that let other companies register domains through them. I've had excellent luck with Joker.com, which is a reseller for CORE.

When you register your domain, the registrar will ask you for five things: the name, address, and phone number of the company, organization or individual that will own the domain; the Administrative Contact (the particular person who owns the domain); the Technical Contact (the person responsible for making everything work); the Billing Contact (who's paying for it); and a list of authoritative nameservers. You must have at least two authoritative nameservers. If you only had one and it went down, nasty things would happen - this is worse than having your Web server go down, and much worse than having your mail server go down. Having two nameservers is a good idea, and all the regitrars I'm familiar with require it.


So, you need somebody to host your domain - in other words, somebody to run those two nameservers. This will normally be the same company that's hosting your Web site, but it doesn't necessarily have to be. They need to know the IP address of your Web server, where to send your e-mail, and anything else relating to your domain name. Note that the domain registrar doesn't need to know any of this; only the company that's hosting your domain does.

Of course, you also need somebody to host your Web site. If you've got a dedicated, high-speed Internet connection, you can set up a Web server and do this yourself. If this site is just for you, go for it - I recommend Apache; it's free, runs on most platforms (including Linux, BSD, Solaris, Mac OS X, Windows 98/NT/2000 and I think BeOS), and is the server software used by well over half the Web servers on the Internet. However, if this is for a business, or anything important, I wouldn't recommend doing your own hosting unless you really know what you're doing. Remember that if you do your own hosting and something goes wrong (your computer crashes, your Internet connection goes down, etc.), people can't get to your Web site anymore. The same goes for running your own e-mail server: unless you really know what you're doing, leave it to people who get paid to make sure you don't have problems.

If the same company is hosting both your domain name and your Web site and e-mail, all you need from them is the names and IP addresses of their DNS servers, and you can go register your domain (or change an existing registration) and they'll make everything work. If different companies are doing it, you'll need to contact the company that will be hosting your Web site and e-mail, find out the names and IP addresses of the Web and mail servers they'll be using, then contact the company that will be hosting your domain and give them that information.


Once you understand the basic concepts, it shouldn't be too hard to fit everything together. If you're confused by something, see what other documentation you can find on the 'Net, and if you have questions, ask people. As with most things, the best way to learn how to do it is to just do it.

If you have comments, suggestions, or questions, feel free to contact me. Thanks to animedragon for her help with editing!