Web 101 - DNS
If you've ever purchased a domain name, you've likely encountered the term "DNS". The Domain Name System (DNS) is the way you point your newly minted domain name to where your website lives.
Like a new home, your new website also has a location. It’s a series of numbers, kind of like a geolocation, called an IP address. It will look something like 22.214.171.124 (that is Google.com by the way). Imagine needing to communicate that series of numbers each time you tried to get someone to visit your website.
"Just look that up on 126.96.36.199"
Thankfully, like addresses, there are domain names. Domain names allow the assigned IP address to be masked with something much more user friendly. But how do you associate that friendly domain name (www.google.com) to that unfriendly IP Address (188.8.131.52)? That’s where DNS comes in.
The DNS connects domain names with IP addresses. When you type a domain name in your web browser, your computer looks up that domain name and and displays the correct website to you. It does this by referencing a DNS directory which has a record of the relationship between the domain name and the IP address.
To keep the look up process efficient, this relationship information is stored in many different places. Usually each internet provider will have a server with a DNS directory. Your computer will also store DNS information for the sites you visit.
Great, but what happens when you want to move your website?
When you change your physical address, you need to let everyone know that you have moved. Heaven forbid you miss a photo radar ticket. When you change your website's IP address, you need to let the directories know so that your domain name directs people to the right place. This means changing the DNS records.
This change happens wherever your nameservers (topic for another post) are. This may be in your registrar account (like GoDaddy) or it might be with another DNS provider (like Cloudflare). There are a few different types of records (again, a broad topic for another post), be sure to only change the records necessary for your website.
- A records are the type of associations mentioned above.
- A domain name is associated with the IP address of your server.
- CNAME records are aliases in the event you want to have several domains, or subdomains pointed to the same IP address.
MX records are used to manage email on your domain. MX stands for Mail eXchanger, which is used to associate the domain portion of your email address to an email server. Just like with web domains, computers need to understand where to send an email to when you enter an email address.
An often overlooked part of the domain name system is a setting called Time To Live (TTL). TTL indicates how often DNS directories should check the relationship between your domain name and IP address. This can range anywhere from a few minutes to a few days. It is important to understand that changing your DNS doesn't instantly make your new site live. It could take up to the time set in your TTL before you see your new website at its new home.
DNS is an often misunderstood source of frustration, but without it we'd have to remember addresses like 184.108.40.206. So, the next time you have that craving for midnight pizza and you google "closest pizza place", you can thank DNS for the simplicity of recalling that one (somewhat strange) name instead of a long list of numbers.