Your internet browser doesn’t actually speak "website name"; it speaks "IP address."

Imagine you’re trying to call your friend, but you only know their name and not their phone number. You’d have to look up their number in a giant, constantly updated phone book. DNS (Domain Name System) is essentially that phone book for the internet. When you type google.com into your browser, your computer doesn’t know where to find Google’s servers. It needs to ask a DNS server, "Hey, what’s the IP address for google.com?" The DNS server looks it up and tells your computer, "It’s 172.217.160.142." Then, your browser can connect directly to that IP address and load the Google homepage.

Let’s see this in action. Suppose you want to find the IP address for example.com. On Linux or macOS, you can use the dig command:

dig example.com +short

And the output might look something like this:

93.184.216.34

This 93.184.216.34 is the IP address for example.com. Your computer, armed with this number, can now initiate a connection to the server at that address. The +short flag just tells dig to give us only the IP address, making it easy to see. If you omit +short, you get a lot more detail about the DNS lookup process, including which DNS server answered the query and how long it took.

The system works in a hierarchical way. At the very top are the "root" DNS servers. They don’t know the IP address for google.com directly, but they know who to ask about .com domains. So, your computer first asks a root server. The root server says, "I don’t know google.com, but I know who manages .com." It then points your computer to a .com top-level domain (TLD) server. Your computer then asks the .com TLD server, "What’s the IP for google.com?" This TLD server, in turn, knows which DNS servers are authoritative for google.com (often managed by Google itself). Finally, your computer asks Google’s authoritative DNS server, which responds with the actual IP address 172.217.160.142.

This entire process, from your computer asking a root server to getting the final IP, happens in milliseconds. It’s a distributed database, meaning the information isn’t all in one place. This distribution is key to its speed and resilience. If one DNS server goes down, there are many others that can handle the request. Caching also plays a massive role; once your computer or a DNS server looks up an IP address, they store it for a while. This means subsequent requests for the same domain are much faster because they don’t need to go all the way up the hierarchy again.

The most fundamental problem DNS solves is abstraction. Humans remember names; computers use numbers. DNS bridges this gap. Without it, every time you wanted to visit a website, you’d need to memorize or look up a string of numbers. It also enables load balancing and redundancy. A single domain name like google.com can resolve to multiple IP addresses. When you ask for the IP, the DNS server might give you one of several available IPs, directing traffic to less-loaded servers or servers geographically closer to you.

When you configure a new router or connect to a new network, you often have to tell it which DNS servers to use. These are typically provided by your Internet Service Provider (ISP), but you can also use public DNS services like Google DNS (8.8.8.8 and 8.8.4.4) or Cloudflare DNS (1.1.1.1 and 1.0.0.1). These public servers are often faster and more secure than ISP-provided ones. If you ever experience slow website loading or can’t reach certain sites, checking your DNS settings is a common first step.

DNS records aren’t just for IP addresses. They can also tell you about mail servers (MX records), other hostnames (CNAME records), and more. The system is incredibly flexible. For example, a CNAME record lets you alias one domain name to another. So, www.example.com might be a CNAME pointing to example.com. This means if the IP address for example.com changes, you don’t have to update the record for www.example.com separately.

The next step in understanding how the internet routes traffic after DNS has done its job is learning about the Border Gateway Protocol (BGP).

Want structured learning?

Take the full Dns course →