Understanding the Domain Name System

Jan 2, 2025

TryHackMe Walkthrough: DNS in Detail Explained

Task 1: What is DNS?

  • Domain Name System (DNS):
    • Functions like the internet's phonebook.
    • Translates domain names (e.g., tryhackme.com) into IP addresses (e.g., 104.26.10.229).
    • Simplifies the navigation of the internet by removing the need to remember numeric IP addresses.

Task 2: Domain Hierarchy

Top-Level Domains (TLDs)

  • gTLD (Generic Top-Level Domain):
    • Examples: .com, .org, .edu, .gov.
  • ccTLD (Country Code Top-Level Domain):
    • Examples: .in (India), .ca (Canada), .co.uk (UK).
  • Over 2,000 TLDs available, allowing for flexible branding.

Second-Level Domains (SLDs)

  • Precedes the TLD in a domain name (e.g., tryhackme in tryhackme.com).
  • Rules:
    • Up to 63 characters.
    • Use letters, numbers, hyphens.
    • Cannot start/end with hyphen; no consecutive underscores.

Subdomains

  • Extends an SLD (e.g., admin.tryhackme.com).
  • Rules similar to SLDs.
  • No character limit for total domain length up to 253 characters.

Key Questions

  • Max length of a subdomain: 63
  • Characters not allowed in subdomain: _ (underscore)
  • Max length of a domain: 253
  • Type of TLD: .co.uk is a ccTLD

Task 3: Record Types

Common DNS Record Types

  1. A Record
    • Maps domain to IPv4 address.
  2. AAAA Record
    • Maps domain to IPv6 address.
  3. CNAME Record
    • Points one domain to another domain name.
  4. MX Record
    • Directs email to mail servers.
  5. TXT Record
    • Stores text-based data.

Key Questions

  • MX record advises where to send email.
  • AAAA record handles IPv6 addresses.

Task 4: Making A Request

DNS Request Process

  1. Local Cache Check
    • Checks if domain is recently resolved locally.
  2. Recursive DNS Server
    • Provided by ISP, checks its cache.
  3. Root DNS Servers
    • Finds TLD server.
  4. TLD Server
    • Directs to Authoritative Name Server.
  5. Authoritative Name Server
    • Returns DNS records.
  6. Response and Caching
    • Uses TTL value for caching.

Key Questions

  • TTL specifies DNS cache duration.
  • Recursive DNS Server often provided by ISP.
  • Authoritative DNS Server holds all domain records.

Task 5: Practical

  • CNAME of shop.website.thm: shops.myshopify.com
  • TXT record of website.thm: THM{7012BBA60997F35A9516C2E16D2944FF}
  • Numerical priority of MX record: 30
  • IP address for A record of www.website.thm: 10.10.10.10

This walkthrough provides an in-depth explanation of DNS, its hierarchy, common record types, and the DNS request process. Understanding these concepts is crucial for managing and troubleshooting domain-related issues efficiently.