Jiggy's Web Fundamentals

Tutorials > The Web > Domains

Domains

What is a Domain?

In the last tutorial we learnt that each computer on the internet has a unique identifier called an IP address. And that if that computer is a web server, we can type out its IP address into a web browser's address bar and request some data that it might have available. If we wanted to host content on the web, we could just give out the IP address of our web server, however, we don't usually use IP addresses to access content on the web do we?

That is where domain names come in. Domain names provide a human-readable address that corresponds to a server on the internet for users to easily access its content. IP addresses are hard to remember and can change over time, so domain names act as an alias for a server which saves us a lot of trouble.

Domain names have a simple structure made up of several parts separated by dots. In the context of regular web browsing we may naturally read them left to right, but in the context of domains, they are read right to left.

An example of a domain name
Figure 1 - An example of a domain name

A domain name consists of several components (like the one above) but generally these fall into one of two categories:

  1. A TLD (top-level domain)
  2. A label

TLD stands for top-level domain and it tells users the general purpose of the service behind the domain name. Some generic TLDs don't require a web server's content to meet a specific criteria (e.g .com, .net, .org). But more specialised TLDs have special requirements. ".gov" for example, is only allowed to be used by governments.

Labels are components of the domain name that come after the TLD. Domain names can have multiple labels, for example, informatics.ed.ac.uk is a valid domain name. A label located directly after the TLD is also called a secondary-level domain (SLD).

So for example, Google controls the google.com domain. That means they can also create "subdomains" with different content located at each (e.g books.google.com, images.google.com) and have many labels in these subdomains.

Who Owns a Domain?

Domain names cannot be strictly owned because otherwise you would quickly end up with a few big companies buying up and hoarding all the domains. Instead, you pay for the right to use a domain name for a set period of time (usually 1 or more years), and can renew your right which has priority over other people's applications for a domain. But you never own it, this is so in time the domain may become available again for other people to use.

What if I want a domain? Anybody can obtain the right to a domain, typically through a registrar. A registrar is essentially a company that keeps information about domain names and other technical things like who registered it and so on. If you wanted to get a domain, you would typically go to a registrar's website and use their "whois" service to see whether a domain is available. Try it here!

Then, if a domain is available and you want it, you can typically fill out a form on a registrar's website to get the domain. Once all the details have been filled out and the domain paid for, the registrar will let you know when the domain is properly registered and accessible on the web. Typically within a few hours it will be available (all DNS servers will have received the DNS record).

If you have a web server that you want to serve content to the web from, you can also configure your domain to point to that server's IP in your registrar's dashboard.

What is DNS?

DNS stands for Domain Name System and is essentially what we've been talking about up until now in this tutorial. But domain names and registering them form part of a much larger ecosystem.

On the internet you have DNS servers, which are special servers around the world that contain a large database of domain names and associated information about them, also known as a DNS record (if you have a domain, you can update your DNS records in your registrar's dashboard). These records are held for a certain amount of time before they are automatically invalidated and then refreshed from top-level DNS servers, also known as authorative name servers (essentially big boss servers that manage the system). When you get a domain or make changes to your domain's DNS records, these top-level servers receive your new information. The process of DNS servers refreshing records from top-level DNS servers is known as DNS refreshing and is what allows a domain name registration to get out there on the web as previously mentioned.

Ok, so let's say there is a web server with an associated domain name. How does your web browser/computer know how to get that web server's content if you are only giving it the domain name and not the exact identifier of the server (the IP address)?

Well, your web browser will make a request to one or more DNS servers to see if they have the DNS record. If they do (which they usually should because of DNS refreshing), then the request can proceed to get the content from the web server with the associated IP address in the record. Your computer will then cache these values (store them locally) for a certain amount of time for future use. So instead, if you are visiting a domain in your web browser, your browser will actually first check the cache and ask your computer to see if it has the IP address. Then if it does, it will use that value otherwise it will check DNS servers as we previously described.

An overview of a network request with DNS
Figure 2 - An overview of a network request to google.com

This process of registering domains, them being sent out to DNS servers via DNS refreshing, your web browser being able to query those servers and then cache those values, is what allows the web to work with domain names as seamlessly as it does; and provide us with easy to remember names for lots of different websites.

Key Concepts Learnt

  • Domain names provide a human-readable address that corresponds to a server.
  • Domains names consist of a few parts to identify the content on a web server in a basic manner.
  • "Ownership" of a domain can be checked and changed through a registrar.
  • The internet contains DNS servers which hold DNS records.
  • DNS servers allow clients on the web to look up the IP address associated with a domain in the DNS record.
  • DNS servers regularly refresh their records from authoritative name servers to keep the web up to date.