Day 007 #FromZeroToHacker – Learning DNS in detail

How many times we couldn’t reach a website because Google had trouble with something called ‘DNS’? What is that? How do we use it? How do DNS requests work?

Let’s learn DNS in detail today in our daily #FromZeroToHacker lesson.

Table of contents
Introduction
What I have learnt today?
Stats
Resources

Introduction to DNS in detail

DNS, or Domain Name System, lets us communicate with devices on the internet. As you have a physical address, your home, every website has its own address: An IP address. But it would be hard to remember that your fav website is 102.42.53.103 instead of https://www…

Let’s learn them in detail.

How DNS in detail woks

What I have learnt today?

What is DNS?

A Domain Name System, lets us communicate with devices on the internet without remembering their IP. An IP address looks like this: 103.10.85.113. 4 sets of digits with a range between 0 and 255, separated by a period.

It would be awful to remember that your favourite website is 103.10.85.113, so thanks to the DNS we just need to remember the name of the site, and the DNS will translate it to the IP address.

DNS process

Domain hierarchy

TLD (Top Level Domain)

A TLD is the most righthand part of a domain name. For example, in google.com, the TLD is .com. There are two types of TLD: gTLD (Generic Top Level Domain), which tell us the user’s purpose, such as .edu (for education) or .org (for an organisation). There is also ccTLD (Country Code Top Level Domain), used for geographical purposes, such as .co.uk for UK or .ca for Canada.

Second Level Domain

The Second Level domain is the domain’s name: If the TLD from google.com was .com, its SLD is google.

Limited to 63 characters + the TLD, and can only use letters (a-z), numbers (0-9) and hyphens.

Subdomain

Sits on the left-hand of the SLD, using a period to separate it, and indicates a subdomain from the main website: maps.google.com, support.google.com, apis.google.com, etc.

The name has the same limitations as the SLD (63 characters, only letters numbers and hyphens, etc). We can create subdomains inside subdomains (testing.maps.google.com), but the total length can’t exceed 253 characters.

What happens when you make a DNS request?

DNS request cycle
  1. When you request a domain name, your computer checks its own local cache to see if you previously looked up the address recently. If not, a request to our Recursive DNS server is made
  2. A Recursive DNS server is provided by your IPS and it has a local cache of recently looked-up domain names. Again, if a result is found locally, it is sent back to your computer. If not, we check the internet’s root DNS server.
  3. The root DNS server act as the DNS backbone of the internet, redirecting you to the correct TLD server. If you request google.com, a petition will be sent to the server that manages the .com addresses
  4. The TLD server holds records for where to find the authoritative server to answer your DNS request (For example, couldflare.com)
  5. An authoritative DNS server stores the DNS record for a particular domain name and sends the DNS record back to the recursive DNS server, where a local copy will be cached for future requests.

Stats

From 295.688th to 278.000th. Let’s go!

Here is also the Skill Matrix:

Skill Matrix

Resources

Path: Pre Security

How the Web Works

TryHackMe: DNS in detail