What is DNS?
What is DNS and how does it work?
Now that we understand how websites are structured and styled, you may be wondering how visitors get to your website. To accomplish this magic we need two things: an IP Address and DNS. These addressing tools are how all traffic is directed, not just on the internet, but across any network where data is going to flow from one machine to another.
What is an IP Address?
An IP Address, or an Internet Protocol Address, is the 32-bit numeric identity of a network interface. This 32-bit identification number is divided into 4 distinct 8-bit sections, called octets. An IP Address is divided into 2 sections, the first represents the network server, and the second part of the IP refers to a specific place on the server.
Now that we’ve cleared that up…wait, still confused?
Think of an IP Address like the address to your home. Your home address is broken into 4 parts: your state, your city, your street, your street address. Each part of your home address brings your packages closer and closer to your home…first to your state, then to your city, then to your street, and finally it arrives in your mailbox.
Your IP address does the exact same thing. Part of your IP address takes your web visitor to your web host, and your web host tells your visitor where to go from there. Of course, you don’t usually enter an IP address to get to a website, you use a domain name. So how does kcxdesign.com become 126.96.36.199?
That’s where DNS comes in!
What is a Dynamic Name Server?
DNS stands for Dynamic Name Server, and it is the tool that converts your domain name into a more specific IP Address. DNS serves an important role because it manages a server’s IP address library. There are 4 steps that occur when a website visitor puts in a domain name, but first, you need to understand that there are two types of DNS: recursive DNS and authoritative DNS.
A recursive DNS is a library of network servers, and it acts as a sort of network hub that tracks all the other webservers on the internet, so when you want to go to a domain, the recursive DNS acts as a sort of postmaster general. This postmaster doesn’t know where to go, but he knows where to go and ask.
DNS step 1: The Query
The first thing that happens when you type a domain name into a browser is that your browser is going to send a request to your ISP’s recursive resolver. The recursive resolver then looks up the first part of your IP Address in search of a more authoritative DNS, it first stops in getting you were you need to go is your root server.
DNS step 2: The Root Server
A root server is a server that tracks information about top-level domains, or TLDs. If you aren’t familiar with a TLD it is the last part of a URL, .com and .org are the most commonly used TLDs on the internet. There are thousands of root servers all around the world, and their job is to push a recursive resolvers query further down the chain of information until they find the information needed to send you were you need to go.
DNS step 3: The TLD Name Server
Once the root server looks at the recursive resolver’s search query it forwards the query to a server that tracks the second-level-domain. The second-level domain name is everything that comes before the .com or the .org in a domain name. So if the root server sees you’re looking for kcxdesign.com, it sends you to the server that tracks all .com URLs. The TLD name server puts your entire domain name together and then sends you to the next step in your journey, the domain name server, or DNS.
DNS step 4: Domain Name Server
We’re almost there because now we find a server where the information on kcxdesign.com is more authoritative, the DNS. The DNS server knows your full domain name and it also knows your IP Address, because this name server belongs to your web host. Once the DNS has given your recursive resolver the IP Address your web browser can now fetch information about the website and start loading it for you.
How long does resolving DNS take?
What a long and arduous journey, right? Wrong. While that seems like a time-consuming task, the recursive resolution of your IP Address takes fractions of a second. Once your domain name is pointed to the right name servers, and then propagated, it takes very little time to trade your domain name for an IP Address.
What’s propagation you ask? That’s simple. Propagation is the time it takes for DNS changes to be updated across the internet. Officially, propagation takes around 72 hours, before that time traffic direction may be unstable, but you can usually start expecting traffic direction to your site within 6-12 hours. The important thing to know about propagation is that during that time, behavior for loading your site can be a little unpredictable.
What tasks does DNS perform?
We’ve just discussed the major task that DNS performs; it directs a recursive resolver to the server folders that your website lives on. However, web visitors aren’t the only ones who might need the location information on your website.
Aside from directing the flow of traffic, DNS will also send e-mail to your e-mail client so that you can receive your electronic mail. You can add special DNS records, called MX records, to direct e-mail queries. Sometimes you may need to prove you own a website or domain, and for that, you can use TXT records as a verification tool. A special protocol sends a query to the TXT file, and if they return positive, then the verification is approved, the most common thing you might need this for is when setting up your Google Analytics account, or when initially setting up your SSL certificates. Speaking of SSL certificates, your DNS will also forward your traffic through a secure socket layer, or SSL, to enforce site encryption.
DNS: Here’s a quick review
DNS’s prime task is to answer queries about what IP Address belongs to a specific domain name.
There are two primary types of name servers: recursive DNS which uses a recursive resolver to query the authoritative DNS server for the exact location of your web files.
DNS doesn’t just direct visitors to your web files, but they also direct email, verify domain ownership and forward site traffic to other locations when the need arises.
Of course, this just scratches the surface of all the utility of DNS, but it is an important introduction for when I explain how email, SSL certifications, and domain verification works. The only thing I really hope you learned is that DNS works a lot like mail flowing through a post office to get your data where it needs to go when it is needed.