The Internet is still a mystery to many people. The goal of this post is to explain the Domain Name System (DNS) in simple terms to help more people gain an understanding. The Internet is a worldwide network of computers and devices that share information. In this network all devices and resources are accessed by IP addresses. The simplicity of this network isn’t very user friendly, though, because in order to access your favorite web site you would have to remember its IP address.
That is where DNS comes into play. It was created to allow easy access to Internet resources. Instead of remembering or bookmarking 184.108.40.206 to access Bing search, it is much easier to remember the domain name bing.com and enter that into your favorite browser. In the background your computer initiates a lookup to a DNS server to resolve the IP address so it knows where to route your request. Here’s how that happens.
First your browser looks at your computer’s local hosts file (located at C:\windows\system32\drivers\etc\hosts) for the domain name to see if it can resolve it. This first step is important to be aware of when you are dealing with web hosting. Sometimes you are moving your site to a new server and need to test it by domain name. By keeping this in mind you can override the live DNS settings for just you and add an entry to your local hosts file. Don’t forget to remove that entry when you are done testing.
If the domain name isn’t found locally in your hosts file then the browser checks your Internet service provider’s (ISP) DNS servers. If those DNS servers don’t have the entry but somebody who uses their service has recently looked up that domain name then it is most likely stored in their DNS cache. That will allow the IP address to be returned so your request can be routed properly.
This brings up a good side topic. All domain names in DNS have a special value called Time To Live (TTL). Often I see this set to 1 hour. What that means is that when the domain name is cached in your ISP’s DNS servers it has a valid life equal to the time given in the TTL. For example if the time to live is 1 hour for bing.com and you try to go to it when that record is 1 hour and 1 minute old, your ISP’s DNS servers consider that cached entry to be stale and take the next action.
The final action that is taken if the domain isn’t found in your hosts file or your ISP’s DNS servers or cached lookups is to go to the root DNS servers. The complexity of this is beyond the scope of this article but all you need to know is that the root DNS servers store the authoritative DNS servers for every domain on the Internet. When you register your domain with a registrar you provide the authoritative DNS servers for your domain name. This information is then stored in the root DNS servers so they know where the IP address mapping can be found when somebody requests it.
Once the request makes it to the root servers they have the information needed to make sure your browser can resolve the IP address and route your request to the appropriate resource on the Internet. You are then on your way and your browser can directly connect to the server that is providing the resources that you are trying to access.
Rick is a Senior Support Lead at OrcsWeb, a hosted server company providing managed hosting solutions.