DNS


Domain Name System

What is DNS?

DNS (Domain Name System) provides a simple way for us to communicate with devices on the internet without remembering complex numbers (IP address)

Types of DNS

.
Pasted image 20250726015606.png|660x377

Top Level Domain (TLD)
  1. Generic Top Level (gTLD)
    • They tell the purpose of the domain
    • com,.edu,.net,.org
  2. Country Code Top Level Domain (ccTLD)
    • used for geographical purposes
    • .ca (Canada), .co.uk (United Kingdom), .in (India)
Second Level Domain
Subdomain

DNS Record Types

DNS isn't just for websites though, and multiple types of DNS record exist. We'll go over some of the most common ones that you're likely to come across.

A Record

These records resolve to IPv4 addresses, for example 104.26.10.229

Pointer Record

It helps in reverse lookup, if you have an ip address it helps you get the domain name.

AAAA Record

These records resolve to IPv6 addresses, for example 2606:4700:20::681a:be5

CNAME Record

These records resolve to another domain name, for example, TryHackMe's online shop has the subdomain name store.tryhackme.com which returns a CNAME record shops.shopify.com. Another DNS request would then be made to shops.shopify.com to work out the IP address.

MX Record (Mail Exchange Record)

These records resolve to the address of the servers that handle the email for the domain you are querying, for example an MX record response for tryhackme.com would look something like alt1.aspmx.l.google.com. These records also come with a priority flag. This tells the client in which order to try the servers, this is perfect for if the main server goes down and email needs to be sent to a backup server.

TXT Record

TXT records are free text fields where any text-based data can be stored. TXT records have multiple uses, but some common ones can be to list servers that have the authority to send an email on behalf of the domain (this can help in the battle against spam and spoofed email). They can also be used to verify ownership of the domain name when signing up for third party services.

Making a Request

image.png|636x503

  1. Check locale cache
    1. Yes , give the address
    2. No, request to Recursive DNS Server
  2. Recursive DNS Server is usually provided by your ISP, but we can also chose our own
    1. It searches in locale cache
    2. Yes, give the address
    3. No, request root server
  3. Root server is DNS backbone of internet, it redirects you to correct TLD Server
  4. TLD asks Authoritative DNS server to answer the request.  The authoritative server is often also known as the nameserver for the domain.  Often we find multiple nameservers for a domain name to act as a backup in case one goes down.
  5. The Authoritative DNS server then sends the sent back to recursive server where it it cached for future use.
  6. DNS record comes with TTL (Time To Live) value, it is represented in seconds until which it should be cached, after which the DNS server has to request for it again.
  7. Caching saves time on making DNS request every time.

Source : TryHackMe