DNS

DNS #

The Domain Name System (DNS) is a crucial component of the internet infrastructure, responsible for translating human-friendly domain names into IP addresses that computers can understand. This section will explain the basics of DNS, how it works, and the different types of DNS records.

What is DNS? #

The Domain Name System (DNS) is a distributed database that maps domain names to their corresponding IP addresses. DNS allows users to access websites and services using easily-remembered domain names (like example.com) instead of numerical IP addresses.

How DNS Works #

When you enter a domain name into your web browser, your computer sends a request to a DNS resolver, which is usually provided by your internet service provider (ISP) or a third-party DNS service. The DNS resolver then queries the appropriate DNS servers to find the IP address associated with the requested domain name. Once the resolver obtains the IP address, it returns the information to your computer, allowing your browser to establish a connection with the web server hosting the website.

The DNS lookup process typically involves several steps, querying multiple DNS servers in a hierarchical manner:

  1. Root servers → The resolver first queries a root server, which provides information about the top-level domain (TLD) servers, such as .com, .org, or .net.

  2. TLD servers → The resolver then queries the TLD server, which provides information about the authoritative name servers for the specific domain.

  3. Authoritative name servers → Finally, the resolver queries the authoritative name server for the domain, which holds the actual DNS records and provides the IP address associated with the domain name.

DNS Record Types #

DNS records are the entries in the DNS database that store information about domain names and their associated IP addresses. There are several types of DNS records, each serving a specific purpose:

  • A (Address) → Maps a domain name to an IPv4 address.
  • AAAA (Address) → Maps a domain name to an IPv6 address.
  • CNAME (Canonical Name) → Creates an alias for another domain name, allowing multiple domain names to resolve to the same IP address.
  • MX (Mail Exchange) → Specifies the mail server responsible for handling email for a domain.
  • NS (Name Server) → Indicates the authoritative name servers for a domain.
  • PTR (Pointer) → Provides the reverse mapping from an IP address to a domain name, used for reverse DNS lookups.
  • TXT (Text) → Stores arbitrary text information, often used for email authentication and domain ownership verification purposes.