Monday, August 28, 2006

Creating a New Domain Name

When someone wants to create a new domain, he or she has to do two things:
Find a name server for the domain name to live on.
Register the domain name.
Technically, there does not need to be a machine in the domain -- there just needs to be a name server that can handle the requests for the domain name.
There are two ways to get a name server for a domain:

You can create and administer it yourself.
You can pay an ISP or hosting company to handle it for you.
Most larger companies have their own domain name servers. Most smaller companies pay someone.
The history of HowStuffWorks is typical. When howstuffworks.com was first created, it began as a parked domain. This domain lived with a company called www.webhosting.com. Webhosting.com maintained the name server and also maintained a machine that created the single "under construction" page for the domain.

To create a domain, you fill out a form with a company that does domain name registration (examples: register.com, verio.com, networksolutions.com). They create an "under construction page," create an entry in their name server, and submit the form's data into the whois database. Twice a day, the COM, ORG, NET, etc. name servers get updates with the newest IP address information. At that point, a domain exists and people can go see the "under construction" page.

HowStuffWorks then started publishing content under the domain www.howstuffworks.com. We set up a hosting account with Tabnet (now part of Verio, Inc.), and Tabnet ran the DNS for HowStuffWorks as well as the machine that hosted the HowStuffWorks Web pages. This type of machine is called a virtual Web hosting machine and is capable of hosting multiple domains simultaneously. Five-hundred or so different domains all shared the same processor.

As HowStuffWorks became more popular, it outgrew the virtual hosting machine and needed its own server. At that point, we started maintaining our own machines dedicated to HowStuffWorks, and began administering our own DNS. We have a primary server and a secondary:

AUTH-NS1.HOWSTUFFWORKS.COM 209.116.69.78
AUTH-NS2.HOWSTUFFWORKS.COM 209.116.69.79
Our primary DNS is auth-ns1.howstuffworks.com. Any changes we make to it propagate automatically to the secondary, which is also maintained by our ISP.
All of these machines run name server software called BIND. BIND knows about all of the machines in our domain through a text file on the main server that looks like this:

@ NS auth-ns1.howstuffworks.com.
@ NS auth-ns2.howstuffworks.com.
@ MX 10 mail

mail A 209.170.137.42

vip1 A 216.183.103.150
www CNAME vip1


Decoding this file from the top, you can see that:
The first two lines point to the primary and secondary name servers.

The next line is called the MX record. When you send e-mail to anyone at howstuffworks.com, the piece of software sending the e-mail contacts the name server to get the MX record so it knows where the SMTP server for HowStuffWorks is (see How E-mail Works for details). Many larger systems have multiple machines handling incoming e-mail, and therefore multiple MX records.

The next line points to the machine that will handle a request to mail.howstuffworks.com.

The next line points to the IP address that will handle a request to oak.howstuffworks.com.

The next line points to the IP address that will handle a request to howstuffworks.com (no host name).

You can see from this file that there are several physical machines at separate IP addresses that make up the HowStuffWorks server infrastructure. There are aliases for hosts like mail and www. There can be aliases for anything. For example, there could be an entry in this file for scoobydoo.howstuffworks.com, and it could point to the physical machine called walnut. There could be an alias for yahoo.howstuffworks.com, and it could point to yahoo. There really is no limit to it. We could also create multiple name servers and segment our domain.

As you can see from this description, DNS is a rather amazing distributed database. It handles billions of requests for billions of names every day through a network of millions of name servers administered by millions of people. Every time you send an e-mail message or view a URL, you are making requests to multiple name servers scattered all over the globe. What's amazing is that the process is usually completely invisible and extremely reliable!

0 Comments:

Post a Comment

<< Home