What is DNS? How does it work? 🤔
If you’re wondering about this key component of the internet infrastructure, you’re in the right place. This guide will answer all of your questions about DNS:
Let’s dive in!
What is DNS?
👉 DNS is short for Domain Name System.
Humans are better at remembering words, while computers are better at remembering numbers. The Domain Name System works to bridge the gap by translating the words you type into your browser (such as domainwheel.com) into an IP address (like 18.104.22.168) so that your computer can understand what website you want to access.
In other words, the DNS is what allows you to access websites without having to memorize long strings of numbers.
For this reason, DNS is often called the “phone book of the internet”:
- Domain name = a person’s name
- Server IP address = a person’s phone number in the phone book
If you know a person’s name, the phone book helps you look up their phone number. And if you know a website’s domain name, DNS helps your web browser discover the actual IP address of the website’s server.
What is a DNS server?
A DNS server is a database where hostnames and their related IP addresses are stored. These servers use specialized software and protocols to help your devices translate hostnames into IP addresses and get you to the correct website.
There are four types of DNS servers:
- DNS Resolver/Recursive Resolver: this is the server that receives your query when you’re attempting to reach a website.
- DNS Root Server: this server pulls the TLD (Top Level Domain, such as .com or .org) from your query and uses it to find the correct TLD server for the site you’re trying to visit.
- TLD Server: these databases collect information about specific TLDs. For example, .com domains are organized into one TLD database. This information is used to connect your DNS client to the correct nameserver.
- Authoritative Nameserver: this type of DNS server is where the records for domains are kept. The Authoritative DNS Server ultimately provides the IP address to your browser.
All four of these server types are involved every time you go to a new website. There are also DNS Caching Servers, which store information about websites you’ve already visited on your device so that those sites load faster when you return to them.
How does DNS work?
There are two main ways you interact with DNS:
- As a person browsing the web
- As a website creator
How DNS works when you browse the web
When you type a hostname (such as domainwheel.com) into your browser, the Domain Name System goes through a seven-step process:
- The Query: this is the initial request for information sent by your browser when you enter a hostname. The query is collected by the Resolver server.
- The Cache: the query is sent to your DNS cache. If there’s no relevant information in the cache, the query gets sent on to the Root.
- The Root: this is when the Resolver server asks the Root server for information. The Root then passes the hostname on to the appropriate TLD server.
- The TLD: the TLD server uses the hostname information to find the Authoritative Nameserver where the appropriate IP address is stored.
- The Final Translation: The Authoritative Nameserver finds the correct IP address and sends it back to your browser.
- Data Request: Your browser sends a request to the IP address for the data associated with the hostname you’re trying to reach.
- Website Display: The web server at that IP address sends the website data, allowing your browser to display the site.
All of this happens in milliseconds, making it possible for websites to load near-instantly. You can make it work even faster by optimizing the DNS settings on your computer.
Optimizing the DNS settings on your computer
Whether you’ve noticed that your internet experience is slow or you’re simply looking for ways to optimize every aspect of your online life, changing your DNS server can help in two big ways:
- Better loading speeds. The DNS provided by your ISP (Internet Service Provider) isn’t always the fastest option. Luckily there are several programs available to help you find the fastest DNS server in your region.
- More privacy. Some ISPs monetize their DNS by redirecting you to a search/advertising page preloaded with information taken from the domain you were trying to search. This involves sending private information to a third party (the search engine), which then influences your search history and general browsing experience.
If you want to use DNS to improve your web browsing experience, check out the PCMag guide to switching your DNS server.
How DNS works when you’re building a website
Every domain is automatically connected to an IP address upon registration, and those IP addresses are stored in a nameserver. The nameserver then tells the internet where your website is hosted. If you bought your domain with your web hosting plan, it will automatically be pointed at the right server.
Sometimes, however, you’ll want to host your site with a different company than the one where you registered your domain.
In these instances, you have two options:
- You can configure your domain name to use your web host’s nameservers, which let you manage all of your DNS information from your web hosting account.
- You can continue managing your domain at your domain registrar and manually add DNS records to direct traffic to your website.
For most people, using the first approach is a lot simpler as it requires less technical knowledge and you won’t need to interact with DNS records directly.
How to point your domain at a new nameserver
The good news is that most web hosts and domain registrars make it really easy to point your site at a new nameserver. You can do it in just a few steps:
- Head to the DNS area of your web hosting account. You can usually find this under DNS Settings or a similar header in the main account area.
- Find the nameservers. You can often find this listed in the DNS Settings area of a site. You can also Google “[your host’s name] nameservers” to find the nameservers for any major web host.
- Open the DNS area of your domain registrar account. Do this by opening a new tab, logging into your account, and heading to the DNS Settings area. You’ll see an area where you can edit the nameservers your site is pointed at.
- Copy + paste your web host’s nameservers into the appropriate boxes. Make sure you copy + paste both of the nameservers listed for your web host into the appropriate area so the domain is fully pointed at your new web host. You must add at least two nameservers, but some hosts provide three or four total nameservers.
- Save your settings.
And voila, your domain is now pointed at the right web host! This makes it possible for people to view your site when they type your domain into their browsers.
What else can you do with DNS?
While the basic purpose of DNS is to connect your website’s domain name to your server’s IP address, you can also use additional DNS records to perform other actions.
Here are some other uses for DNS records:
- Set up a subdomain on your site.
- Verify your site with tools such as Google Search Console or Ahrefs.
- Set up a custom email address for your domain name.
You’ll manage your domain’s DNS records from wherever the nameservers are hosted – e.g. your web host, your domain registrar, or a service like Cloudflare.
Here’s an example of DNS records at Cloudflare:
Final thoughts 🏁
The Domain Name System or DNS is one of the most fundamental building blocks of the internet. 🌐 Thanks to it, you can enter a simple, word-based URL into your browser instead of being forced to memorize a long, numerical IP address.
As a web browser, the DNS does its thing behind the scenes every time you type a website address into your browser. As a website creator, it is the system that makes sure visitors get to your site, as long as your DNS settings are pointed at the right nameservers.
Want to learn more about internet infrastructure? Check out 👉 our article that explains what an IP address is.