DNS: Surveying Your Domain

Introduction to DNS

Imagine trying to navigate a city where every building is identified only by a set of GPS coordinates. It would be nearly impossible to remember or find your way! The Internet faced a similar problem in its early days, where users had to memorize numeric IP addresses for every connected device. Enter the Domain Name System (DNS), the Internet’s address book that translates human-friendly names into machine-readable IP addresses.

This lesson will cover the following:

What is DNS?

DNS, or the Domain Name System, is a distributed system that provides easy-to-remember names for networked devices. It functions like a phonebook, allowing you to look up the IP address of a website using its domain name.

DNS was developed to solve a growing problem in the 1970s: managing a centralized list of hostnames and IP addresses for the ARPANET. Initially, this was handled by manually updating a text file, but as the network grew, the system became unmanageable. In the 1980s, DNS was introduced to distribute this workload across multiple organizations, paving the way for the Internet's rapid expansion.

Understanding Domains

A domain is the "friendly" name of a website’s host server. It’s part of a URL (Uniform Resource Locator) but doesn’t include application or protocol information. Here’s a breakdown of a typical URL:

https://www.example.com/path?query=string

Domain parts:

How DNS Works

DNS resolves domain names into IP addresses through a hierarchical process. Here’s how it works:

  1. A user enters a URL into their browser (e.g., https://students.appacademy.io).
  2. The DNS system starts by querying the rightmost part of the domain (the TLD, such as .io).
  3. The TLD’s name server directs the query to the next segment (e.g., appacademy.io).
  4. This process continues until the authoritative name server is reached, which provides the IP address for the full domain.

Analogy: Imagine trying to find a friend’s house in a new city:

DNS Records

DNS records are stored in zone files, which are simple text files containing information about a domain. Here’s an example of a basic zone file:

$TTL 299
my-site.com.    IN  SOA     ns1.cloudflare.com. dns.cloudflare.com. 2032032092 10000 2400 604800 3600
my-site.com.    IN  NS      ns1.my-site.com.
my-site.com.    IN  A       104.28.31.159
my-site.com.    IN  A       104.28.30.159
www             IN  CNAME   my-site.com.

Common DNS record types:

Time to Live (TTL)

DNS records include a TTL (Time to Live), which determines how long the record is cached. A shorter TTL ensures updates propagate quickly, but longer TTLs improve performance by reducing the number of queries.

Key Takeaways

DNS makes navigating the Internet user-friendly and scalable, ensuring the web remains accessible to everyone.