MobDojoStart learning free

How Computers Work · Your Computer on a Network · Lesson 2 of 5

DNS: Names to Numbers

How your computer turns a website's name into an address it can reach.

9 min50 XPLab in Pro

Turning names into numbers

You type names like library.example into your browser. But computers don't find each other by name. They need an IP address, the number you met in the last lesson.

DNS (Domain Name System) is the system that turns a website's name into its IP address. People often call it the internet's phone book. You look up a name, and you get back a number.

A domain name is the name part of a web address, such as library.example or microsoft.com.

Here is what happens when you visit a site:

  1. You type the name and press Enter.
  2. Your computer asks a DNS server, a computer whose job is to answer these lookups.
  3. The DNS server replies with the site's IP address.
  4. Your browser connects to that address and loads the page.

This all takes a fraction of a second, so you never notice it.

Which DNS server does your computer ask? Usually the one your router tells it to use. Often the router passes the question on to your internet company's DNS servers. That's why, in the last lab, the DNS server was often the router's own address.

Some people choose a different DNS service instead. Windows lets you change this in your network's properties, under DNS server assignment. On a Mac, it's the DNS tab in the network Details window. Most people never need to change it.

Your computer also keeps a short memory of recent answers, called the DNS cache. This saves time when you visit the same site again.

When DNS breaks

Here is a strange problem that fools many people. The Wi-Fi icon says you're connected. But no website will open. It looks like the internet is down.

Often, the internet is fine. What broke is DNS. Your computer can still reach the internet, but it can't turn names into numbers. Without the number, the browser has nowhere to go.

Signs that point to DNS:

Common causes are a router that needs a restart, a problem at your internet company, or a DNS setting someone changed by hand.

Things to try, in order:

  1. Restart the router. It's often the computer's DNS server, so this clears many DNS problems.
  2. Restart the computer. This also clears its DNS cache.
  3. If you are comfortable with the terminal, type ipconfig /flushdns and press Enter. Flush means empty: it throws away saved answers so the computer asks again.
  4. Check that the DNS setting is back on automatic, unless you set it on purpose.

The Mobile Networking course covers this for phones, including encrypted DNS. Phones work the same way. A phone on Wi-Fi uses the same router for DNS, so if both your phone and computer fail on Wi-Fi at once, the router is the likely cause.

Test yourself

Can you answer these?

  1. What does a DNS server give back when your computer asks about a website's name?
  2. Your laptop shows Wi-Fi connected, but every website says "Server not found". What is a likely cause?

Answer them in the app to earn 50 XP (Pro).

Answer in the app