Skip to Main Content
PCMag editors select and review products independently. If you buy through affiliate links, we may earn commissions, which help support our testing.

What Is DNS? Everything You Need to Know About the Web's Phone Book

Conducting a web search? The Domain Name System converts website names into IP addresses so your computer can understand the query. Here's what that means.

July 5, 2022
(Image: Mopic / Shutterstock)

If you’ve ever had to fiddle with your Wi-Fi settings, say at the local coffee shop when the connection isn’t working, chances are you have come across the term DNS server somewhere. But what does DNS mean, and how does it work?


What Is DNS, Anyway?

dns server

Simply put, Domain Name System (DNS) is the phone book of the internet. It’s the system that converts website domain names (hostnames) into numerical values (IP address) so they can be found and loaded into your web browser.

This happens because machines don't understand site names like we do. A website written as pcmag.com is a way for us, as humans, to remember web pages while the servers they’re stored on refer to them as numbers.

DNS works in the background, and it's not something the average internet user will need to worry about much. But without it, your browser wouldn’t know where to point your web page request, and finding the information you need would be a much more arduous process.


How DNS Works

When you type a web address into your search engine, such as youtube.com, your computer conducts a search for the website's corresponding IP address to find the right page. Popular websites like Google have multiple IP addresses that can be used simultaneously to prevent a backlog of web traffic. 

According to networking software company Cloudflare, four main servers play a part in the hostname-to-IP address conversion, also called DNS resolution. Cloudflare likens this process to a librarian being asked to find a book and progressively narrowing their search:

  • The recursive DNS server: Usually the first stop your request makes. It gets the initial query, checks the recently cached addresses, and sends a request to servers further down the line if it can’t find the right IP for your website. This would be the rack of recently returned books that have yet to be re-shelved.

  • The root name server: Helps translate site names into IPs by pointing your request toward more specific areas. This is equivalent to a specific section of the library.

  • The top level domain (TLD) nameserver: Narrows the search even further by hosting specific top level domains, which are the last portion of a website’s hostname like .com, .org, or .edu. A search for pcmag.com, for example, would be pointed to the .com TLD nameserver. There are banks of TLD nameservers located all around the world to improve the speed of handling requests. This would be a specific rack of books within that section.

  • The authoritative nameserver: The last stop your request makes, this server hosts specific IPs for domain names. Once it receives the request, it will return the corresponding DNS record so the web page can load. If the server doesn’t have the record, it returns an error message. This is the book with the information the librarian first set out to find.

Once the proper IP address is found, the information is sent back to your browser and the web page loads. The recursive DNS server also stores that IP in its cache memory for a few seconds to a week. This is done so that the server can quickly return the address without having to query the other servers. Think of this as similar to the RAM in your computer, which stores information about recently opened applications so it can access them more quickly the next time they’re used. 

If a query gets all the way to the authoritative name server level and the IP address still can’t be found, an error message is returned to your browser. This might seem like a lengthy process, but it happens in less time that it takes you to blink—usually a few milliseconds.


What to Do When Something Goes Wrong

flush dns cache in command prompt

The DNS usually works without a hitch, but glitches happen. If the website you're trying to reach changes servers, that cached address may not load. Maybe the servers doing the checking are slower than they should be. In either case, there are fixes available.

If there's a caching issue, you can flush your DNS cache to start from scratch, so your computer looks up web addresses on the DNS server again. Do this by opening the Command Prompt in Windows or Terminal in macOS and running a simple command, which will tell your computer to delete its reserve of cached websites in order to find the correct servers.

If the problem is with the servers themselves—maybe your ISP-supplied DNS servers aren't properly configured—you can switch servers in order to optimize your web searches and speed up the process. Enter your device's network settings and manually add the IP address—such as 1.1.1.1 for Cloudflare or 8.8.8.8 for Google—to connect to the desired DNS server. You can also do this at the router level, but the exact process differs based on the router you have.


A Cybersecurity Warning

diagram of DNS poisoning
How DNS cache poisoning happens (Credit: Cloudflare)

Hackers have sometimes taken advantage of lax oversight and used DNS maliciously. One example of that is DNS cache poisoning, in which false data is fed into the DNS cache that directs people to malicious websites hosting data-swiping malware.

Cyberattackers can also use DNS as a way to get data packets with malicious software into a system, a type of attack called DNS tunneling. This attack hides bad software behind seemingly innocent DNS traffic and is often used to establish a command and control connection with a target network. Bad DNS cache data will often remain on the server, directing new queries until it expires or gets removed manually, meaning a lot of people can be misdirected if DNS traffic isn’t regularly monitored.

While most protective measures won't fall to the everyday user, it pays to be aware. For instance, you could change to Google's Public DNS servers, which promise a level of protection your ISP's server may not provide. And for many reasons, it's a good idea to invest in malware protection.

Like What You're Reading?

Sign up for Tips & Tricks newsletter for expert advice to get the most out of your technology.

This newsletter may contain advertising, deals, or affiliate links. Subscribing to a newsletter indicates your consent to our Terms of Use and Privacy Policy. You may unsubscribe from the newsletters at any time.


Thanks for signing up!

Your subscription has been confirmed. Keep an eye on your inbox!

Sign up for other newsletters

Table of Contents

TRENDING

About John Bogna

Contributor

John is a writer/photographer currently based in Houston, Texas. He's written on everything from politics to crypto wallets and worked as a photojournalist covering notable events like the Astros Victory Parade and the Day for Night Music Festival. Current hobbies include learning to shoot 35mm film, building Spotify playlists, and working his way through that menacing TBR stack on the nightstand.

Read John's full bio

Read the latest from John Bogna