What Is DNS, How Does It Work and Why Is It Important?

Points of discussion in this guide include:

What is DNS?

DNS stands for Domain Name System. This system is arguably one of the most important aspects of the Internet. It ensures the Internet is not only user-friendly but also works smoothly, loading the content users ask for quickly and efficiently.

Let’s start with some of the most basic DNS terms.

1. IP Address

An IP address is a unique group of numbers, separated by full stops. Each computer and server that uses the Internet has its own IP address, and this enables computers to communicate over the network.

142.251.40.206
31.13.71.36
31.13.71.174

As computers deal in numbers, it makes sense that computers are identified via IP addresses. But for humans, remembering a string of numbers each time you want to visit a website just doesn’t work. That’s where domain names come in.

2. Domain Name

A domain name is the name of your website (i.e. WebsiteHosting.com). Domains can be purchased through a domain registrar, or are often provided for free through your hosting provider.

Without domain names, to open a website you would need to remember and type in a site’s IP address (not easy!) while using domain names makes visiting websites quick and straightforward and gives the process a human approach by using words instead of numbers.

By the way, there can be up to 127 levels of subdomains, and each label can have up to 63 characters. The total domain character length can have up to 253 characters.

3. Domain Name System

DNS is a large network of servers located across the globe that contain a distributed database of domain names and IP addresses. Often referred to as the Internet’s address book, DNS connects domain names to IP addresses.

So when you type in a site’s URL into your browser, the DNS will find the IP address that matches the domain name and your browser can then contact the right server and retrieve the website and its content.

142.251.40.206 = Google.com
31.13.71.36 = Facebook.com
31.13.71.174 = Instagram.com

Each time you visit a website your browser first performs a DNS lookup. Complex pages may require multiple DNS lookups to start loading and your computer could be doing hundreds of lookups per day.

How Does DNS Work and Why Is It Important?

DNS is the cornerstone of how the Internet operates. Every time you type a domain name into your browser, your computer refers to a DNS server to find the corresponding IP address.

When you type a website domain into your browser, like ‘websitehosting.com’, your computer will use a DNS server to resolve the IP address of the website’s server. Once the IP address has been identified, your computer can then contact the the server, which in turn will serve the website that you want to access.

The process of translating IP addresses to domain names is called a DNS resolution.

DNS resolution is a well-known bottleneck in web surfing. Due to the distributed nature of the system, complex pages may entail multiple DNS requests and round-trips across the internet to start loading, requiring seconds and sometimes even longer. This puts in jeopardy our goal of fetching several hundred documents per second.

Now, let’s look in more detail at DNS to gain an understanding of how it works, and just how important it is.

The DNS Network

Fundamentally, the DNS is a database of website domains and IP addresses. Its key task is to store the data and link the domain names and IP addresses when requested. However, there are other a couple of other crucial aspects of DNS that underpin its functionality:

  • Distribution – DNS records are distributed over a vast network of connected servers, with each server only handling a small portion of data.
  • Record Maintenance – This process involves locating IP addresses connected to domain names and storing this data.
  • Hierarchy – The hierarchical structure of DNS enables a user to quickly find the correct server that hosts the DNS records that they require. (We will cover this in more detail next).

These mechanisms combined ensure that when you enter a domain name into your browser, the name is converted into an IP address. However, it is the domain namespace that enables the DNS to work so efficiently.

Domain Namespace

The domain namespace refers to the hierarchical structure of the DNS servers. Let’s look at how this structure enables the DNS to function.

domain name structure

When you type a domain name into your browser, your computer will check its cache to see if it has previously requested that domain name. If no record is found, a request is sent to your local DNS server (which is most commonly provided by your Internet service provider).

The local DNS server will now check to see if it has any records in its cache. If not, it will need to locate the details of the name server that hosts the domain record for that particular domain.

To do so, the local DNS server breaks the domain name into sections. For example, www.websitehosting.com would be split into:

  • com
  • websitehosting
  • www

The ‘com’ section is the known as the top-level domain (TLD). The local DNS server will first connect to a root name server to find details of the server that holds the domain info for this TLD.

Once the TLD name server IP address is known, the local DNS server will make a request to this new server to find out which name server holds details on the second part of the domain name (i.e. websitehosting).

After that the local DNS server will make further requests for the name servers that contain data on websitehosting.com and then www.websitehosting.com, working down until the IP address has been resolved. Your browser can then use this IP address to contact the server hosting the website.

DNS servers

In the simplest DNS lookup, when there is no caching, the four groups of servers (recursive resolvers, root nameservers, TLD nameservers, and authoritative nameservers) work together to fetch the IP address for a specified domain.

  • Recursive resolver, or DNS recursor is a server responsible for receiving queries from client browsers and deliver requested data. After receiving such query, a recursive resolver will either respond with cached data, or send additional consecutive requests to a root nameserver, TLD nameserver, and an authoritative nameserver. After receiving a response from the authoritative nameserver containing the requested IP address, the recursive resolver then sends a response to the client.
  • Root nameserver is responsible for directing the recursive resolver to a TLD nameserver, based on the extension of that domain (.com, .net, .org, etc.). The 13 root nameservers are known to every recursive resolver, and they are the first stop in a recursive’s quest for DNS records.
  • TLD nameserver is the next step in search for a specific IP address. It maintains information for all domain names within a single domain extension, such as .com, .net, etc. For example, a .com TLD nameserver contains information for every website that ends in ‘.com’.
  • Authoritative nameserver is the last stop in the nameserver query. It stores the DNS records that map domain names to IP addresses and responds to a recursive resolver with the IP address of the server found in the DNS A record.

Although this is a simplified version of how the DNS works, it gives you a good understanding of the hierarchical structure that is used to enable DNS servers to resolve domain names.

DNS Records

Now we know a little about what the DNS does, how it works, and why it is so important. Next, let’s look in more detail at how you can configure the DNS records for your own websites’ domains (and why you might want to do that).

NS Records

As already mentioned, name servers are servers that store DNS records of a given domain. They host a domain’s DNS records in a text file called a Zone File.

dns records for websitehosting.com

These DNS records are essentially settings, mapping your domain to IP addresses, and are used to point your domain to your web server and email services.

If you have registered your domain name with one company and have purchased hosting through another, then you will need to either change name servers or alter your DNS records, so computers can easily find the correct server that is hosting your site.

After purchasing a domain name, you should have DNS access via your domain registrar.

digitalocean nameservers at godaddy

Here you can change your name server, which is a quick and easy process that takes just a few clicks. (If your domain name and hosting has been purchased through the same service, then you won’t need to change anything).

SOA Record

SOA, or Start of Authority is the most important entry because it stores authoritative data regarding domain, such as primary name server, domain serial number, webmaster email, when the domain was last updated, and how long the server should wait between refreshes.

All domains must have a SOA record to work properly and to conform to IETF standards.

Now have a closer look at a few of the most important DNS records that you can configure.

A Records

A Records are the most basic and common type of DNS record, with the A standing for Address. An A record quite simply maps a website’s domain name to its IP address. If you want to direct your domain to an IP address other than the one your domain registrar has provided (as previously discussed), then you can do so by altering the A Record.

CNAME Records

CNAME is an abbreviation for Canonical Name records. A CNAME record is similar to an A record and also widely used. This type of record points a domain to another domain, instead of an IP address. You may want to edit the CNAME record if you own more than one domain name, but would like them to all feed directly to one central website.

MX Records

A Mail Exchanger (MX) record is a DNS record that specifies the mail server that accepts messages on behalf of your domain. So when email is sent to your domain, they can be routed to the named mail server.

TXT Records

Originally used to store arbitrary human-readable text notes. Now this record is most commonly used to verify whether emails are originating from a trusted domain name, and therefore, if they are safe, as well as ownership verification of a domain.

Make sure you can edit all these DNS records through your domain account, or via your hosting account in the control panel.

DNS Propagation

When you change your name server, it may take up to 48 hours, sometine even longer, for the changes to be propagated throughout the Internet. This process is called DNS propagation – spreading the new DNS records through the vast network of DNS name servers.

The reason for the time delay is that the all DNS servers across the globe need to update their caches with the new information about your domain. During the propagation time, some visitors to your site may be directed to your old server for some time, whilst others will use your new server straight away – this is dependent on the local DNS server that each individual’s computer is using and whether that DNS server has been updated yet.

If you have made changes to your DNS records and want to check the current state of propagation, you can use a global DNS propagation checker like WhatsMyDNS.net.

websitehosting dns propagation check

This tool enables you to check a random selection of DNS servers across the globe to see if your domain has propagated.

DNS Lookup and Health Check Tools

There are a number of popular DNS tools that you can use to check the health of your domain’s DNS records. This can be useful if you have run into problems and need to diagnose what the issue is and where it is occurring.

Here are some of the most comprehensive tools currently available for checking your DNS:

intoDNS

Into DNS

intoDNS provides simple but useful DNS and mail server reports. It highlight any DNS record issues and offers suggestions on how to fix problems.

DNS Spy

DNS Spy

DNS Spy detects errors and warnings about domains’s DNS configuration, as well as suggests solutions on how to fix the issues.

DNS Inspect

DNS Inspect

DNS Inspect is another free tool that will allow you to check your domain’s servers for common DNS errors and mail errors. It also provides reports on how to fix any issues you may have with your DNS. Although you need to create an account to access this tool, the in-depth reports provided make this extra step well worth it.

MXToolBox

MX Toolbox

MXToolBox offers a domain health check, helping to determine if all of your systems are working and performing at their optimal level. This tool uses DNS to obtain the hostnames of your DNS servers, web servers, and mail server and then queries them to identify potential problems. MXToolBox will report back, highlighting any critical issues, and offering supporting documentation on how these problems can be resolved.

Public DNS Servers

Your local ISP probably doesn’t have the fastest DNS service. Their servers are often slow and unreliable, which in turn can lead to a sluggish browsing experience on your computer. An easy way to counter this problem is to switch to a robust name resolver.

Cloudflare (1.1.1.1) and Google (8.8.8.8) are among the fastest public DNS servers in the world and very easy to setup. Both can help you speed up your browsing experience, improve the security while surfing the web, and get the results you expect with minimum propagation lags.

Google DNS

Google Public DNS

Google Public DNS is currently the largest public DNS service in the world, handling billions of requests a day. Using a global anycast network, Google DNS provides increased speed and security, as well as reduced latency, and is totally free to use.

To access Google DNS, you will need to configure your network settings. This involves explicitly changing the DNS settings in your operating system or device to use the Google DNS IP addresses.

The Google Public DNS IP addresses (IPv4) are:

8.8.8.8
8.8.4.4

The Google Public DNS IPv6 addresses are:

2001:4860:4860::8888
2001:4860:4860::8844

The process for altering the DNS settings varies depending on the operating system (Windows, Mac, etc) or device (phone, computer, or router) you are using. To find out exactly how to swap to Google, check out their extremely useful Get Started Guide.

Cloudflare

Cloudflare Public DNS

Cloudflare’s public DNS resolver (1.1.1.1) offers a fast and private way to browse the Internet because it is deployed in hundreds of cities worldwide, and has access to the addresses of millions of domain names on the same servers it runs on.

The service is completely free and requires no technical skill or special software installed. Just change the DNS settings to use the Cloudflare DNS resolvers.

IPv4:

1.1.1.1
1.0.0.1

IPv6:

2606:4700:4700::1111
2606:4700:4700::1001

Refer to Cloudflare Help Docs if you have any problem changing the DNS settings.

After changing your DNS settings, make sure you clear your browser cache as well.

Flushing a DNS Cache

A DNS cache is a temporary database kept by a computer’s operating system, that contains records of domain and IP addresses. Any recent visits you have made to websites will be stored in your computer’s DNS cache, and then referred to when you want to revisit the website. This helps your computer load up known sites faster, as it does not have to refer to your network’s DNS server to find the IP address.

However, when you configure DNS records, your computer’s DNS cache can slow down the time it takes for you to access your website on the new server. As your domain name is cached on your computer with your old IP address, your computer will continue to use this database and load from your old server. To override this problem you will need to clear your computer’s DNS cache.

This process is also known as ‘flushing’. When you flush your computer’s DNS cache you will remove all the present data, so all future addresses will be taken from your network’s DNS server and then restored. Flushing can also help eliminate computer viruses and protect you from hacking. Therefore, clearing out your DNS cache is a beneficial task.

How to Flush DNS

Flushing your DNS cache is a quick and extremely easy job.

For Microsoft Windows:

  1. Click on the Start Menu and select Command Prompt.
  2. Then type in the command ipconfig /flushdns.
  3. You should now see the message Successfully flushed the DNS Resolver Cache.

For MacOS users:

  1. Select Applications > Utilities > Terminal.
  2. Then type the command dscacheutil -flushcache.
  3. This will clear your DNS cache, although no message will show afterwards to tell you it has been successful.

A router can also contain a DNS cache database. Consequently, when you clear your computer’s DNS cache, it is important to also reboot your router to clear any DNS entries it may have stored. Once the DNS cache is flushed, your computer will now refer to its network’s server for DNS records. If the DNS server has been updated you will receive your website from its new server.

FAQ

A DNS is a globally distributed service that translates human-friendly names like www.websitehosting.com into the numeric IP addresses that computers use to connect to each other. It works much like a giant phonebook by managing the mapping between names and numbers. Thanks to DNS servers, people don’t have to memorize complex IP addresses.

A DNS resolution is the process of converting domain names to IP addresses, means that when a DNS server is queried about a domain name, it responds with an associated IP address. The process also works in reverse. In a reverse DNS lookup, a DNS server is queried about an IP address and it responds with a name.

DNS records are instructions how to handle requests for that domain. They store important information about a domain including what IP addresses are associated with it, mail configuration, text values to verify ownership of a domain, etc. Some of the most commonly used DNS record types are: SOA (Start of authority), NS (Name server), CNAME (Canonical name), A (IPv4 address), AAAA (IPv6 address), MX (Mail exchange), TXT (Human-readable text).

To edit a domain’s DNS zone file you need to login to a hosting provider’s dashboard, most likely that would be a cPanel. To update DNS records log in to cPanel, open Zone Editor and click Manage to view the domain name you need to edit. Locate the DNS record you wish to update and make the necessary changes.

To run a DNS health checkup on any domain there are a number of popular DNS tools that you can use to find issues and warnings. For example, dnschecker.org, dnsspy.io, or intodns.com. These tools can be quite useful if you have run into problems and need to diagnose what the issue is and where it is occurring.

On the Windows machine open the Command Prompt, type ipconfig /all and press Enter. On Mac run the Terminal app, type scutil –dns | grep ‘nameserver\[[0-9]*\]’ and hit Enter. Check your DNS settings and verify that they are correct.

If you have issues connecting to websites try switching your DNS to public DNS services, i.e. Google: 8.8.8.8/8.8.4.4 or Cloudflare: 1.1.1.1/1.0.0.1.

If you get “DNS Server Not Responding” error try using a different web browser or device first. If that doesn’t work, restart your router and clear the DNS cache. If the problem remains deactivate your firewall temporarily, reset your IP, and flush the DNS cache once again.

Final Thoughts

As you can see, DNS is the backbone of the Internet, ensuring that your browsers display the websites that you request. Working in the background, DNS stores, searches for, and matches all domain names to IP addresses, enabling computers to connect, and websites to be served.

Have you got any questions about DNS? Please feel free to ask in the comments below.

Avatar

Dmitry

An Internet marketing enthusiast from Newport Beach, California.

Was this post useful?

Average rating 4.8 / 5. Vote count: 38

Blog

5 comments

  1. Thanks and a well-explained article. In your DNS Lookup Tools, you mentioned a few tools. I was Googling for some DNS resources when I got to another similar but somewhat more useful tool https://dnschecker.org/ that provides 300+ DNS servers for lookup. You might want to give it a try.

  2. Thank you so much for sharing your knowledge. I like your full DNS information. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *