Every time you visit a website your browser finds that website among the billions of other websites out on the internet. How does your browser do it? DNS enables your browser to run laps around the globe, sort through billions of websites, and deliver data to you almost instantly. Sounds magical. It is the magic of DNS.
Metaphor for DNS
DNS works the same way as when your grandmother sends you a birthday card every year. Before she mails it, she checks her address book for your address. If the address is not there, she can call your mom to get your address. If your mom does not have your address, she can call your girlfriend. When your grandmother finally gets your address, she can mail you a birthday card with a $25 dollar check. Nice.
This metaphor makes DNS sound simple. So, when your grandmother asks you how the recipe for pecan sandies shows up on her laptop, you can tell her is just like when she sends the birthday checks. However, if your web surfin’ grandmother is anything like me and she really wants to know all the details. It gets complicated fast.
THe Technical side of DNS
DNS is the Domain Naming System for everything connected on a network. It resolves domain names and IP addresses. The internet has a backbone, a nervous system, and synapses. DNS is the internet’s synapses.
Another name for a web address is fully qualified domain name, or FQDN. When you enter an FQDN into a browser, the browser uses it to find the DNS record. The DNS record contains the corresponding IP address. This process is called domain name resolution. Now you can establish a connection and communicate with the web server hosting the website.
DNS records can be found in many places. The first place is the browser cache. The browser cache temporarily holds DNS records for websites you visited in the past. If the browser cache does not have a DNS record for the website, the browser checks the DNS cache of the operating system. The DNS cache is also tied to a special plain text file on the OS called the hosts file.
Because of its unique position in the DNS process, the hosts file can also be used for internal redirecting, piracy, or as a security exploit. In the days of ARPANET, users would manually update the hosts file with DNS records. Eventually, the internet grew so much the system had to be automated.
By now your browser has checked the browser cache, the DNS cache and the hosts file, but it still has not been able to achieve name resolution. Depending on the network environment, there might be a router with the record. There could also be a DNS server, called a third level domain name server. If the browser still has not been able to find that pesky record. The browser leaves the bounds of its local network and journeys into the cloud.
DNS recursion is the process of sending queries between different types of DNS servers. The four main types of DNS servers are DNS resolvers, root servers, TLD name servers, and authoritative name servers.
There are two types of queries, a recursive query and an iterative query. A recursive query occurs between the user and a DNS resolver. If there is no cached record, the DNS resolver performs iterative queries to the other types of DNS servers. The portions of the FQDN dictate where iterative queries go, starting with with root servers, then TLDs, and finally authoritative name servers.
After recursion, your web browser should have the necessary IP address to establish a connection with the web server hosting the website. Additionally, the DNS resolver, routers, operating system, and browser all cache the record. Caches help regulate network traffic and give you a faster browsing experience.
I used to have a hard time troubleshooting DNS, but once I got the hang of it I was inspired to write this post. Not surprisingly, I’ve only scratched the surface of DNS. I look forward to the next time someone asks me What Happens When You Visit a Website?
- Microsoft TCP/IP Host Name Resolution Order
- DNS Server Types
- How can I tell if my ISP Allows Third-Party DNS Providers?
- How Domain Name Servers Work
- Steps to Troubleshooting DNS Issues
- DNS Explained
Very interesting read Ken. I was considering setting up my own LAN separated from the household LAN and this provided…