How do Domains and DNS Actually Work?

When I first started on my own web development and hosting business 8 years ago I had no clue about was DNS or Domain Name Servers worked. To that point I also had very little knowledge about registering and maintaining domains. I have talked about registering domains way back in the past, but today I am going to talk a little on how DNS works.

Domain Background

When you register a domain you have ownership over a little piece of the Internet. What you do with that plot of real estate is up to you. There are several TLDs or Top Level Domains that none of us can actually register, but we can register Second Level Domains (SLD), such as ProfessionalASPNET.com. The COM part is the TLD and the ProfessionalASPNET is the SLD. You could add any third level or sub-domains you want to your SLD, Blogs.ProfessionalASPNET.com for example.

Common TLDs
  • COM
  • NET
  • ORG
  • BIZ
  • INFO
  • NAME
  • Country Specific (US, UK, CA, EU, etc)
  • MOBI

So why do we have domain names and how do they work. People have a much harder time remembering numerical IP addresses. So average users, such as out mothers, really do not have the capacity memorize or really care about IP addresses. So ProfessionalASPNET.com is much easier to remember than 216.27.17.86. So the first purpose is it makes things much easier for average users to access our properties.

The next reason domains are great is we have so many more possibilities for addresses. We are currently running out of IPv4 IP addresses, hence the plans for IPv6. Domains give us a infinite number of potential web addresses. The other day I made a post about host headers, the reason host headers are great is because domains provide a massive layer of abstraction for us to host numerous sites on one IP address.

Finally it is a great branding tool. With ProfessionalASPNET.com I sort of tell you what this site is all about. FindMyGolfCourse.com is a site to help you locate US golf courses, the IP address really would not help the average user know what our property is all about.

The DNS Process

How do they work? I try to explain it in terms of sending a letter via snail mail, that is right the good ole post office. In the US addresses consist of a street address, city and state and a zip code, which is 5 digits, or a 5-4 format. DNS servers act as the post office of the Internet.

So when you request a site for the first time your client machine will ask its current name servers what the IP address of the domain. If they do not know, then the client will ask the magic TLD domain servers in the sky. They will respond by saying they do not know, but they know who is supposed to know. So your client machine now asks that name server where the domain is hosted and if all has been configured properly that DNS server will respond with the IP address. Now your client will ask the destination server for the actual response from the server.

  1. Local Cached IP
  2. Client DNS Server
  3. TLD DNS Servers
  4. Domain's DNS Server
  5. Domain's Server

So that is several steps to a very transparent and important process. So where do some of these things come into play? Each computer retains a cached version of any domain's IP address once it has requested it. This address is cached for a period of time, which is set in the domain's A record (more on records later).

If the local computer does not have a local copy of the address it will then fall through the above process. The local computer's DNS server will typically retain a copy of the domain's address. In many enterprises there is also a proxy server in place and that may have a cached copy of the address as well. These cached copies are great because they help the request happen much faster, which is good for the user experience.

When you register a domain you typically specify at least two domain name servers, a primary and a secondary. You can register more and could just register one DNS server. These are maintained by the TLD name servers, so when you change these, such as changing a hosting provider, this will cause the process to take 12-72 hours to roll over.

The whole system, as far as the Internet is concerned is managed by Internic. This is a non-partisan organization that is funded by high level ISPs. When you are working behind a corporate firewall this would be maintained by your internal IT department and their name servers.

What is in a DNS Record

So what exactly is in a DNS record? This record contains the mapping for a domain, and can actually map out some service protocols, like e-mail. An A record is the primary record for the domain and will be the IP address for the domain. For example 216.27.17.86 is the IP address in the A record for ProfessionalASPNET.com. A CNAME or alias record specifies another name for the domains, www.ProfessionalASPNET.com is mapped to the A record for ProfessionalASPNET.com. Additionally most domains will also have at least one MX record that points to the A record for the domain's mail server. Many times this will be configured as mail.{domain}.com or something similar. There are many more records that can be contained in a DNS record, but I am not going to cover them today.

The use of domains gives us a nice way to abstract out the ugliness that can be Internet addressing. It was one of the main conventions that helped popularize the Internet to the masses by making use of the Internet relatively easy. Having a little understanding of how paths are set can really help trace resolution issues when they popup. Having a distributed DNS routing system allows the Internet to be relatively flexible to help when changing physical addresses. It is not a great idea to change the physical address very often, but domains make the process relatively easy.

Share This Article With Your Friends!

Googles Ads Facebook Pixel Bing Pixel LinkedIn Pixel