I explain Domain Name Servers and Name Servers to a friend of mine all the time. He builds web sites part time. I know he’s not alone; DNS confuses a lot of people.
The internet works by assigning an address to each device attached to it. This address is called an Internet Protocol Address or IP Address for short. It’s a 32 bit number that’s commonly written as 4 segments or octets (called an octet because each 4th is 8 bits) such as 10.10.1.1 or 216.54.217.22. Each octet can range between 0 and 255.
This address works just like your street address: a packet (a chunk of communication between two devices) leaving your computer and heading for Google moves through devices called routers that route traffic on the internet.
The router looks at the destination IP Address and knows which way to send the packet.
Just like a letter moves through various post offices and delivery vehicles (mailman, mail trucks, airplanes, etc.) your little packet of internet traffic moves across various communication channels (phone lines, cable lines, fiber, etc.) and providers (UUNet, Cogent, Level3, Time-Warner, AT&T, Sprint, AboveNet, etc.). It finally arrives at its destination and is processed and a return packet is sent back… in just the same way, it finds its way back based on your IP Address.
The Internet would be pretty hard to use if you had to remember all those IP Addresses when you wanted to visit a web page, so a naming scheme is used that allows you to enter a name that is easy to remember instead of a sequence of numbers. So, how does your computer get the IP Address of a web site when you type in the name? That’s where Domain Name Servers do their job.
Name Servers. A Name Server holds the information that relates the IP Addresses for a web site to the names used to access that web site. If you want to have a web site with a domain name, you have to register or purchase (more like rent) the domain name from a service call a registrar.
When I registered the domain name for my web site, I told the registrar what Name Server I was using, Most people will use the Name Servers provided by their hosting facility (where they rent the server space for their web site). That Name Server is configured to have a “zone” for my domain and that zone contains records that relate a name to an IP address, this is called an “A Record”. An “MX Record” is used to identify the mail server for that zone, for example, I have an “A Record” for my domain that points to the IP address of the webserver, and the “MX Record” points to the mail server for my domain. These may or may not be on the same server.
When someone sends me an email, their mail server will request the Name Server for my domain and will get it’s IP Address, then it can request the MX Record and get it’s IP Address, and then it can send packets of mail to the mail server for my domain.
Domain Name Servers. A Domain Name Server stores the domain names and associated IP Addresses for a period of time.
This is stored or cached on a server called a Domain Name Server or DNS server for short. If the time specified for caching a domain name / IP Address relationship has passed the DNS server will remove it from its cache.
When a request for an IP Address is made, and the DNS server does not have that address in its cache, the DNS Server will make a request to a set of special servers on the internet that hold the addresses for all the Name Servers and which domain names each one controls. It can then send a request to the name server for that domain to get the IP Address for the domain name and return it to the computer or device making the original request.
All Internet Providers have several DNS servers and as you browse the internet your computer is constantly sending requests to these DNS servers to get (or resolve) IP Addresses for the domain names you type in or links you click on.
A web site’s name to address relationships are stored on Name Servers, as you browse the Internet, DNS servers either provide the address back to your computer from cache, or, look up the Name Server for your domain and then gets the correct Name Server to get the IP Address.
Now you too understand DNS and Name Servers!