PhoneBoy Explains: DNS
Here's another topic to test the cumulative effect of the geek-o-meter: DNS. What is it? How does it work? Why should I care?
To understand what DNS does, let me draw an anlogy. When you call someone on the telephone, you call them using a telephone number. What if you don't know the person's telephone number, but you know their name and where they live? You look it up in the telephone book or call information. To access a host on the Internet, whether it be by email, IRC, the World Wide Web, FTP, telnet, or whatever, you need to use what is called an IP address to contact that host. An IP address is like that phone number.
Most everyone advertising their website these days publishes the "hostname" of their website (e.g. www.radionet.com), not the actual IP address, which may change from time to time. This is where DNS comes in. DNS stands for Domain Name Service. Based on the fully qualified domain name of a given host (e.g. www.radionet.com), you can find a person's IP number. Or, given an IP number, you can find out the fully qualified domain name of the machine that uses that IP number. It's a kind of "caller ID." Some anonymous FTP sites will not let you into their site unless it can take the IP address of your host and find the name that's associated with it.
Back in the old days of the Internet, when it was called ARPAnet, there was no such thing as DNS. InterNIC, the place that is the keeper of all the domains, had something called HOSTS.TXT, which is equivelant to a phonebook for all the hosts on the Internet. Back when the Internet was small, this was quite managable. Whenever someone wanted to add a new host to the Internet or change an existing one, they'd send it off to InterNIC and they'd update HOSTS.TXT. It's like your phone list at home -- it's a big list of everyone's hostname and their IP numbers. It became clear during the 1980's that this method was unfeasible, given that changes were occuring faster than InterNIC's ability to change HOSTS.TXT and everyone else's ability to keep up with the latest HOSTS.TXT. It's like having your phonebook change every second and having to call your local phone company to get a new phone book that will be hopelessly out of date by the time you get it.
After much debate, two RFCs were drafted to explain the official implementation of DNS. For those who don't know, an RFC is a "Request for Comment". It is a formal document that describes how something is implemented on the Internet. For the geeks among you, the two RFCs that describe DNS are RFC1034 and RFC1035. A web search should turn up the location for these documents if you want to educate yourself further.
So how does DNS work? Well, if you need someone's telephone number, you dial information to get someone's telephone number. That number is something easy to remember, like 411 or 555-1212. DNS does something similiar. When you set up the TCP/IP protocol on your machine, one of the things you set up is the IP number of a DNS server. This is sort of like programming your computer for the local number for "information". This DNS server is either somewhere on your local area network or on your Internet Service Provider's network. How can your local DNS server know about the millions and millions of hosts on the Internet? Well, it really doesn't. Your local DNS server knows about hosts on it's local network and the IP numbers of other nameservers, called "root namesevers", who know about the rest of the world. And really, all the root nameservers know is all the DNS servers for every top-level domain in the world.
A request to look up the IP address for www.radionet.com might go something like this. The DNS server on your local ISP sends a request to the root nameservers to find the DNS server for 'radionet.com'. One of the root nameservers says "hey, I know who knows about radionet.com, it's this guy." That guy is queried, he says "yup, I know this guys' IP address" and passes it back to the root namesevers who passes it back to your local DNS server who passes it back to you. If your local DNS server is configured correctly, that lookup for www.radionet.com will be stored in a 'cache'. Now if you want to know about www.radionet.com again in the near future, the local DNS server will just pull it from it's cache and not do that dialog again.
There's one cool thing that DNS allows. When you send mail, often the "host" you send mail to, most often a domain, does not directly correspond to a host on the Internet (i.e., there is no host that identifies itself as 'phoneboy.com'). Well then how does email get to me? Mail Exchanger, or MX records in DNS provide this capability. For a domain like phoneboy.com, there are several MX records that point to my Internet Service Provider that processes mail for that domain. These records insure that mail is delivered to some host that can process the email for that domain. Back when direct TCP/IP connections to the Internet were rare, these were necessary to insure that mail got to those who could not afford or did not want direct TCP/IP access to the Internet.