DNS Records Notes

Taking from TryHackMe’s DNS in Detail course.

DNS - Domain name system

Communicate with devices without remembering complex numbers

every computer has a unique ip address:

  • 4 swets of digits ranging from 0-255 separated by a .
  • Instead of remembering an Ip address, we input a DNS (e.g google.com)

Domain hierarchy

image.png

TLD - Top level domain

  • most righthard part of the domain name
    • e.g tryhackme.com TLD is .com
    • 2 types of TLD: gTLD (generic top level) and ccTLD (country code top level domain)
    • historically, gTLD was for the domain’s purpose. e.g .com is commercial, .org for organisations, etc…
    • ccTLD for geographical → e.g .ca for canada, .co.uk for uk, etc..

Second level domain:

  • for trahackme.com → tryhackme is thesecodn level domain
    • limited to 63 characters
    • TLD can only use a-z0-9 and hyphens
      • can’t start/end with hyphens or consecutive hyphens

Subdomain

  • for admin.tryhackme.com the admin is the subdomain
  • same restrictions as second level domain in terms of naming
  • you can use multiple subdomains split with periods to create longer lengsths
    • length muist be kept ot 253 characters or less
    • no limit to subdomains

Record Types

A Record:

  • records resolve to IPv4 addresses
    • e.g 104.26.10.229

AAAA Record

  • records resolve to IPv6 addresses
    • e.g 2606:4700:20::681a:be5

CNAME Record

  • records that resolve to a different domain name
  • e.g a subdomain name for store.tryhackme.com could return a CNAME record shops.shopify.com in which another DNS request to that record will be conducted to find the IP address

MX Record:

  • records resolve to the address of the servers that handle the email for the domain that is being queried
  • a MX record response for tryhackme.com would be something like alt1.aspmx.l.google.com
  • records also have a priority flag
  • tells clients in which order to try servers
  • good 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
  • can be used to verify ownership of the domain name when signed up for third party services

Make a request

  1. When you request
    1. first check local cache if address recently visited
    2. if not, reuqest to your recrusive DNS server made
  2. A recursive DNS server typically provided by ISP (internet server provider) but you can choose your own
    1. server also have recenttly used domain names
    2. if locally found, sent to computer
    3. if not found, serrch continue at internet root DNS servers
  3. root servers are the DNS backbone of the internet → redirect you to the correct top level domain server
  4. the TLD server holds records for where to find the authoritiative server to answer the DNS requests
    1. authoritative server also known as the nameserver for the domain
      1. e.g tryhackme.com could have name server kip.ns.cloudfare.com and uma.ns.cloudfare.com
      2. often multiple name servers as back up
  5. authoritative DNS server is responsibile for storing the DNS records for a particular domain name and where any updateds to your domain name DNS records would be made
    1. depending on record type, the DNS record is sent back to the recrusive dns server where a local copy is cached
    2. DNS records come with a TTL (time to live) value
      1. value represented in seconds that the response should be cached for
    3. caching saves on having to make a DNS request every time you communicate with aserver

Diagram of Sending Requests

Fun terminal commabnds

nslookup shop.website.thm

finds DNS records for a domain name

You can look into specific types of records if you want