How DNS and domain names work

A domain name is a website’s address on the internet. It helps your web browser find the web page you are looking for.

What is a domain name

Every domain name consists of at least two parts: The TLD (Top Level Domain) and the actual domain known as the SLD (second level domain). The SLD is also known as the apex domain, root domain and base domain.

For your web browser to display a web page it needs to translate the domain name into something called an IP address.

Every device connected to the internet has an IP address. An IP address looks something like this

For your web browser to find the IP address there could be 5 different places to check:

The process of finding the IP address is called the Domain Name System (DNS) and this is how it works.

Local check

Your web browser first checks if your computer knows the answer.

Everytime you go to a website your browser will remember it’s IP address for a little bit.

If the web browser can’t find the answer locally or has forgotten the answer it will ask the resolver server (also known as the recursive DNS servers).

Resolver server

The resolver server is usually your internet service provider (ISP).

If the resolver doesn’t know the answer it will find the answer for you – starting with the root server.

Root server

All resolvers must know one thing: where to find a root server. Root servers are scattered around the globe and operated by 13 independent organisations.

The root server doesn’t tell the resolver where to find the IP address. Instead it tells the resolver which top level domain (TLD) server to talk to. For example if you were trying to find the root would tell the resolver to check with the .org TLD server.

TLD server

There are over 1,000 TLD servers. There is one for .com domains, another for .gov domains, and so on.

The TLD servers job is to tell the resolver where it can find the authoritative nameserver for the domain you are looking for.

Authoritative nameserver

The resolver has finally come to the right place. The authoritative nameserver knows the IP address and tells the resolver.

The resolver then tells your web browser, which then means you can see the webpage. This all happens in a few milliseconds.

At the same time the resolver remembers the IP address of the website you just went to so if anyone else asks for the same site it has the answer.

Quick recap

If your browser doesn’t know a websites IP address it will:

  1. Ask the resolver (the resolver is normally your internet provider).
  2. If the answer is no the resolver will find the answer by asking the root. The root will give the correct TLD server.
  3. The resolver asks the TLD server and gets told the correct authoritative nameserver.
  4. The resolver asks the authoritative nameserver and gets the domain name’s IP address.
  5. The resolver tells your machine the IP address and now you can see the website.

How DNS works from resolver, root, TLD to nameserver

Time-to-live (TTL)

The resolver and your local machine won’t remember a domains IP address forever. Each domain name has something called a TTL (time-to-live). The TTL indicates how long until your computer, or resolver has before it should recheck with the authoritative nameserver.

Hopefully this post helped. If it still doesn’t make sense I found this website very useful and this video also gives a good summary.

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts