DNS Basics

“This post is part of a new series designed to help developers who are just starting out understand some basics and how they relate to WordPress. This first post is about DNS, including what it is and why you need to understand it.”

DNS – The Basics

DNS stands for Domain Name System, so let’s get that out of the way first. Every time you use the internet you’re interacting with it, whether you realize it or not. That’s because DNS is a protocol within a set of standards for how computers exchange information with one another (TCP/IP protocol suite). The graphic above depicts a common DNS interaction between user, computer, server, ISP, and more. An ISP is just an internet service provider (think cable company for example) so that’s easy to wrap your head around.

From User-Friendly Domains to Server-Speak

The basic goal of the DNS system is to take user-friendly domain names like test.com and route them to the appropriate IP address since servers don’t speak domain lingo. For example, the DNS system might translate test.com to an IP address of 70.70.700.70 behind the scenes when you’ve typed it into your browser. This task is handled by something called a domain name server, DNS server, or name server. All three tend to be thrown around and mean the same thing. We’ll use the terminology DNS server for the purposes of this article since it’s the most descriptive of the three. Basically, the DNS server has a database of domains and which IP address each maps to and just sends the request (user) to the proper location based on the records it has at the time of the request. The proper name for this process is DNS name resolution, since it’s resolving the domain to the proper IP address.

You can always bypass DNS by entering a site’s IP address directly into the browser instead of the domain. This is a good way to test for things to see if the issue is related to your domain being pointed incorrectly for example. Keep in mind IP addresses can change over time so that’s another reason domains work better. Google.com might be powered by a certain IP address one day and a different one the next, so it’s easier to just navigate to Google.com rather than trying to keep up with the current IP address they have assigned to their server. Also it’s important to understand that some sites (like Google) associate more than one IP address with their domain which is just one more reason the DNS system is so helpful.

Zone Files and Name Servers – What’s the Deal?

Ever heard of a zone file? Don’t worry if you haven’t. It’s essentially a text file that lives on your DNS server (aka name server) and it holds the secret map that connects your domain with its IP address. Think of it as the GPS for your domain, guiding all web traffic to the right destination. 

So, when you point your domain to a certain name server, you’re basically telling the DNS system where to find this GPS. The name server then uses the zone file to translate your domain name into the right IP address. It’s like saying, “Hey, you want to find my place? Here’s the map!”

The Lowdown on CNAMEs and How They Compare to A Records

Now, let’s talk about CNAMEs, or Canonical Name records. Unlike an A record, which straightforwardly links a domain to an IP address, a CNAME record takes a more roundabout route. It points a domain to another domain name. 

Imagine you have a domain like shop.example.com and you want people who type in store.example.com to end up at the same spot. That’s where a CNAME record comes into play. You’d set up a CNAME record to point store.example.com to shop.example.com and let the DNS system do the rest. 

Interestingly, the way CNAMEs work is almost like the opposite of A records. While an A record gives a domain a direct route to an IP address, a CNAME record points a domain to another domain. It’s like saying, “Don’t ask me for directions, ask that guy!” This can be super handy for managing multiple domains or subdomains because if the IP address changes, you only need to update the A record and all linked CNAME records will follow the lead.

Who Handles DNS Name Resolution?

So how does your laptop at home connected to the internet via your cable provider (ISP) know which IP address to resolve a domain to? There’s obviously a DNS server handling the DNS name resolution process, but who is doing it? In this case, since your ISP is your cable company, it’s them! For example, if you have your laptop connected to a modem from your cable company, they’ve likely sent some network configuration info to the modem that is then passed on to your laptop. Part of this information is typically a dictation of which DNS servers the laptop should use when translating domains to IP addresses.

Stay tuned for future posts on things like HTTP vs. HTTPS, rsync, FTP vs SFTP, SSH, and more.

New Posts in your inbox