The Domain Name System (DNS) is one of the most critical components of the World Wide Web (WWW). It helps you go from typing a web address into your browser to seeing the correct website on the screen.

Today this process happens so quickly it’s easy to take it for granted. However, a complex set of processes is happening behind the scenes to help you browse fine websites such as this one!

Table of Contents
    What is DNS and How Does It Work? image 1

    Some Internet Basics

    The internet is essentially many computers tied together with network cables, radio signals, and various other methods of carrying a digital signal. What unifies all these devices and network technologies together is Internet Protocol (IP).

    A communications protocol describes the rules and language devices use to talk to each other. Any two devices (whether a smart fridge, laptop, smartphone, or robot vacuum cleaner) can send and receive information between each other as long as they use the same protocol.

    What is DNS and How Does It Work? image 2

    IP networks assign a unique number to every device known as its IP address. The IP address exists so that the packets of data sent across the network have a clear destination.

    Your internet gateway device, usually a wireless router, has a public IP address that anyone on the internet can see. Since IP addresses also represent physical locations on a network, it means that an IP address also shows your approximate location! However, you don’t have to type in an IP address to access things on the web. That’s exactly where DNS swoops in to save the day.

    Thank Goodness for URLs

    Internet addresses such as https://www.online-tech-tips.com are known as URLs or Uniform Resource Locators. These addresses are easy for humans to remember because they’re usually chosen to be memorable. This is the string of text you type into a web browser like Chrome’s address bar to visit that site.

    What is DNS and How Does It Work? image 3

    However, the actual computer that contains the website and other content you access has an IP address, not a URL. In fact, a single URL can point to multiple IP addresses since multiple servers worldwide can host the same websites and data.

    DNS Servers Turn URLs Into IP Addresses

    A DNS server is a computer on a network that takes the URL you type in and then compares it to a database of IP addresses to see which one is associated with the URL.

    What is DNS and How Does It Work? image 4

    It’s like looking up a phone number in a phonebook. Once you find the person’s name and initials, there’s a phone number listed next to it. It’s the number that makes the phone ring and the IP address that puts your computer in touch with the web server it’s looking for.

    How DNS Works Step-By-Step

    Let’s look at what happens after you open your web browser, type in a URL, and press Enter.

    1. First, your browser checks the DNS cache, where previous requests have been stored as DNS records. So if you’re visiting the same website repeatedly, you don’t have to wait for a DNS response every time. The browser will also check your computer’s Hosts file. This is a list of manual URLs with a record of their matching IP addresses known as hostnames. The Hosts file takes priority over everything, so your browser will go to the IP address listed there, if any.
    2. If the information isn’t available locally, your web browser sends a request to a DNS resolver. This is the server that most people refer to as a DNS name server. But actually, the resolver is just part of the more extensive DNS system. The resolver is typically operated by your Internet Service Provider (ISP).
    What is DNS and How Does It Work? image 5
    1. Suppose the ISP’s local DNS resolvers (usually at least two) don’t have the information you need in its cache. In that case, it has to send the request further up the chain to a DNS root name server. A root name server has no information on IP addresses and URLs. Instead, it has information on Top-level Domain (TLD) name servers and redirects requests to their location. The top-level domain is the .com, .org, and other suffixes you see at the end of a web address. If your URL is a .com, the TLD server that handles .com domains is the next stop.
    2. The TLD nameserver will then supply the second-level domain. That’s the “google” in “google.com,” for example. The TLD server knows which name server has the IP address information for that second-level domain and its subdomains and forwards the DNS lookup request to that destination. This server is known as an Authoritative name server. The authoritative DNS server provides the actual IP address and then sends it back to the DNS resolver that your browser originally contacted.

    That’s quite a journey, but the amount of time a DNS query usually takes is between a fraction of a second to a few seconds.

    DNS Can Change Your Internet Experience

    Not all DNS resolvers are created equal. It’s not uncommon for some ISPs to manage their DNS servers poorly. They may give them inadequate caches, slow hardware, insufficient bandwidth, or buggy software.

    What is DNS and How Does It Work? image 6

    From your perspective, this results in a web page that generates DNS errors or simply takes a long time to open the first time. This is why many people opt to change their preferred DNS servers to alternative servers. For example, Google runs DNS servers at 8.8.8.8 and 8.8.4.4. OpenDNS offers servers at 208.67.222.222 and 208.67.220.220. There are many more apart from these two examples, offering many choices most web users don’t even know they have.

    Choosing the right DNS service can transform your browsing experience. Some offer faster and more reliable lookups than your ISP, and others may have special features such as blocking malicious sites.

    Smart DNS Services

    Smart DNS services are another alternative to public DNS servers. These are usually paid subscription services and offer fine-grained control over your DNS requests. They are often used to circumvent geographical restrictions.

    Still, unlike a VPN, a Smart DNS can selectively redirect you to servers in other countries only for services you specify and leave the rest of your browsing untouched. On a VPN, you’d have to implement a method known as split-tunneling to get a similar result, but split-tunneling is more complex to set up than a smart DNS.

    Reverse DNS Lookups

    The DNS process we’ve described so far is known as a “forward DNS lookup,” and most DNS requests are of this type. However, it’s also possible to perform a reverse lookup. This is where you know the IP address of a server, but you don’t know which URL is associated with that address. This can be useful when you can only see the IP address of a server in your network logs and want to know who it belongs to.

    DNS and Privacy

    Public DNS services are generally vulnerable to eavesdropping, and the DNS service itself may keep logs of which websites you’ve asked for. This means that third parties can know exactly which websites you’ve visited and when you’ve visited them.

    What is DNS and How Does It Work? image 7

    The DNS system was never designed to be inherently private, but the state of the internet today makes privacy a key issue for everyone who connects to the web. This has given rise to Private DNS services. Some are paid, but some companies, such as Cloudflare, offer free private DNS servers. These servers are configured not to keep logs and make it harder for outsiders to eavesdrop or interject DNS communications. This brings us to the final important thing you should know about DNS.

    Hackers Can Use DNS Against You

    There can be a dark side to the DNS system. Through a practice known as DNS spoofing or DNS cache poisoning, malicious actors can corrupt your ISP’s DNS cache by impersonating the server and sending fake DNS data back to the resolver.

    So what this means is that when your computer sends out a DNS lookup request, it can be redirected by a poisoned cache to a malicious site. The most dangerous thing about this is that there’s nothing that you could do to prevent this. So you’ll have to rely on your internet security systems and take any warnings that a site’s certification isn’t correct seriously.

    What is DNS and How Does It Work? image 8

    Cache poisoning is also an excellent reason to use major DNS services from companies like Google and Cloudflare since they are less likely to fall victim to spoofing. However, the process of DNS resolution is still the best way anyone has invented to quickly and efficiently navigate the web. So you must take the rare hacking attack with all the good that DNS brings.