What is a domain name? and How does DNS work?

Domain names help solve a common problem that humans have – difficulty remembering numbers. In this article we learn about domain names, what they are, how they solve this problem and the underlying infrastructure that makes this possible – the Domain Name System.

Overview

Humans have difficulty remembering numbers, however we can remember names much more easily. Consider the list of contacts found in your smartphone.

When we make a call, we don’t usually enter an actual phone number. We usually just select a name from a contact list. This association of names to numbers, allows us to interact with computers and machines more easily.

Internet-connected computers use IP addresses in order to be reached by other devices. This is often an IPv4 address which looks like this: 192.168.30.1 or it could be an IPv6 address, such as: fe80::315:7dff:fef0:6341

Picture of two browser windows. One with a domain name entered into the address bar. The other with an IP.

Domain names

Domain names are similar to the names in our contact lists. They both associate names with numbers, in this case IP addresses and not telephone numbers.

Structure of a domain name

Domain names have a fairly basic structure, consisting of various labels. Using the domain name: blog.example.com. Let’s have a look at the components, starting from right to left.

Diagram indicating the top-level domain of blog.example.com. In this case it is .com

TLD (Top-level domain)

TLDs are one the final components of a domain name after the root of the heirarchical DNS.

Diagram indicating the second-level domain of blog.example.com. In this case it is example.

SLD (Second-level domain)

SLDs are directly below a TLD. They often refer to the organization that has registered the domain.

Diagram indicating the subdomain of blog.example.com. In this case it is blog.

Subdomain

Subdomains are domains that belong to another domain. In this example “blog.example.com” is a subdomain of “example.com”.

Diagram indicating the fully-qualified domain name. In this case it is blog.example.com.

FQDN (Fully-qualified domain name)

Fully-qualified domain name is a domain that contains all the labels necessary to look up using DNS.

Diagram indicating the URL that resolves the domain. In this case it is https://blog.example.com.

URL (Uniform resource locator)

With the addition of the https:// this fully-qualified domain becomes a URL.

How to buy a domain name

If domain names could be bought, the Web would subsequently fill up with unused domains that no one else could access. Therefore, we rent domain names to ensure that they eventually become available to use again.

Registrars

Registrars use domain name registries that manages the reservations of the domain name, and tracks information that allows users to connect to their domains.

Here are a few popular companies that provide registrar services:

Understanding DNS

Many average Internet users think that when they want to go to a website, they simply enter a domain name and then some server or machine returns the web page. For example, if asked to create a diagram that demonstrates this, they might come up with something like this:

A diagram illustrating how a novice Internet user might understand DNS.
How the average Internet user might view DNS

However, there is much more that is happening behind the scenes. In fact, there is an enormous amount of complexity behind the DNS protocol.

Domain Name System (DNS)

The Domain Name System, also known as DNS, resolves IP addresses based off of fully-qualified domain names (FQDN). DNS is a distributed system, consisting of different DNS servers. These servers manages lists of domain names and IP addresses.

One job of DNS is to take domain names, and find out what IP address is associated with it.

Basic DNS requests

DNS servers handle DNS requests and responses. To illustrate this, let’s examine a basic request:

  1. Enter blog.jordanholt.dev into a browser’s address bar.
  2. The browser will check with your computer in the local DNS cache, to see if you have already requested that resource. If the domain name is found in the DNS cache, it is translated to an IP address and the browser requests the resource.
  3. If the computer does not have the IP address associated with the domain in the local DNS cache, it then proceeds to ask a DNS server. DNS servers could be in a local network, however they are often controlled by an ISP.
  4. The DNS server then returns the associated IP address for that domain name and your browser can then request the resource.

Now that we understand how DNS works on a basic level, let’s dive deeper and learn about authoritative DNS servers.

Authoritative name servers

Authoritative name servers are responsible for answering requests for specific DNS zones. For example, the authoritative name server for example.com will contain information for that specific zone.

When your ISP or local DNS server cannot resolve a certain domain name, it will query a DNS root server to find out where it can locate the information it needs. The IP addresses for these root servers is stored on every DNS server in a file called, the root hints.

A diagram of a distributed system of DNS servers - including root DNS servers and name servers.

Wrap up

Domain names are human-readable addresses, that allow us to easily interact with network-connected computers. One of the primary jobs of DNS, is to resolve IP addresses based of off domain names. This task is accomplished through a distributed system of DNS servers.

We discussed the basics of DNS requests and the underlying architecture. Next time we will dive deeper into this fundamental part of the Internet infrastructure.

Further reference

Published
Categorized as Beginner