🌐

Understanding DNS: Fundamentals and Functions

Sep 18, 2024

TryHackMe DNS Room Lecture Notes

Introduction to DNS

  • Presenter: John
  • Platform: TryHackMe
  • Topic: Detailed exploration of DNS (Domain Name System)
  • Purpose: Understand how DNS works and its role in accessing internet services

Task 1: What is DNS?

  • DNS Definition: Domain Name System allows communication with internet devices without remembering complex IP addresses.
  • IP Address: Unique address for internet communication, typically four sets of numbers (0-255), separated by periods (four octets).
  • DNS Function: Converts human-friendly domain names (e.g., tryhackme.com) to IP addresses.

Task 2: Domain Hierarchy

TLD (Top Level Domains)

  • Definition: Rightmost part of a domain (e.g., .com in tryhackme.com).
  • Types:
    • gTLD (Generic): Indicates domain purpose (e.g., .com, .org, .edu).
    • ccTLD (Country Code): Indicates geographical location (e.g., .ca, .co.uk).
  • New TLDs: Frequent introductions of new TLDs (e.g., .online, .biz).
  • Action: Suggests exploring domain registration sites for more TLDs.

Second Level Domain

  • Example: trihackme in tryhackme.com.
  • Restrictions: Up to 63 characters, using A-Z, 0-9, and hyphens (no hyphens at start/end or consecutive hyphens).

Subdomains

  • Example: admin in admin.tryhackme.com.
  • Structure: Can have multiple subdomains (e.g., jupiter.servers.tryhackme.com).
  • Restrictions: Similar to second level domains; no limit on the number of subdomains.
  • Importance: Relevant in web hacking and cookie management.

Task 3: DNS Record Types

Common DNS Record Types

  • A Record: Resolves domain to an IPv4 address.
  • Pointer Record: Reverse lookup, finds domain associated with an IP.
  • Quad A Record: Resolves domain to an IPv6 address.
  • CNAME Record: Alias for domain names, resolves to another domain.
  • MX Record: Directs email to mail servers for a domain.
  • TXT Record: Stores arbitrary text, used for email verification and anti-spam measures.

Task 4: Making a DNS Request

DNS Request Process

  1. Local Cache Check: Checks if domain address is cached locally on computer.
  2. Recursive DNS Server: Provided by ISP, checks its cache and contacts root DNS servers if not found.
  3. Root DNS Servers: Redirect to appropriate TLD server based on request.
  4. TLD Servers: Directs to authoritative name server for domain.
  5. Authoritative DNS Server: Stores DNS records and updates; sends records back to recursive server.
  • TTL (Time to Live): Specifies how long DNS record should be cached locally.

Task 5: Practical DNS Queries

  • CNAME Query: Determine canonical name for subdomains.
  • TXT Record Query: Retrieve text records for domains.
  • MX Record Priority: Find priority value for mail exchange records.
  • A Record Query: Obtain IP address for domain records.

Conclusion

  • Resources: TryHackMe Discord & Subreddit for further questions.
  • Note: Always practice and explore further to solidify understanding of DNS and its applications.