A brief introduction to DNS

Phonebook of the Internet

What is DNS ?

The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. The Web browsers interact through Internet Protocol (IP) addresses and the DNS translates the domain names to IP addresses so that, the browsers can load Internet resources.

Each device connected to the Internet has a unique IP address which is used by other machines to locate the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

How does DNS work ?

DNS resolution is the process of translating a hostname, like example.com, into an IP address that is understandable by computers, such as 192.168.1.1. It is like a street address that may be used to find a specific house. An IP address is a unique identifier that is assigned to every device on the internet.

'Behind the scenes' operations, which involve no user engagement after the initial request, is what we need to examine in order to comprehend how DNS functions.

There are 4 DNS server involved in loading a webpage:

  1. DNS Recursor: This can be thought of as a program that receives the query from the client and makes additional requests to satisfy the client's DNS query.

  2. Root NameServer: In order to resolve a DNS query, start here. It serves as a guide, indicating the next step to locate the TLD (Top-Level Domain) Name Server. With over 700 separate servers for redundancy and 13 different types of root name servers dispersed throughout the world, DNS resolution is guaranteed even in the event that some servers go down.

  3. TLD NameServer: For Top-Level Domain, TLD stands. After a DNS query has been answered, the final portion of the domain name—such as the.com in example.com—is hosted in this stage.

  4. Authoritative NameServer - This completes the process using this nameserver. It gives the IP address for the requested domain, such as example.com, and can be compared to a dictionary that stores domain names.

    By following these steps, the DNS system efficiently translates human-readable domain names into IP addresses, allowing users to access websites without needing to remember numerical addresses.

DNS Lookup and Webpage Query - Cloudflare

Steps in DNS Lookup

There are 8 steps in a DNS lookup:

  1. A user types example.com into a web browser, and the query travels into the Internet and is received by a DNS recursive resolver.

  2. The resolver then queries a DNS rool nameserver (.).

  3. The root server then responds to the resolver with the address of a TLD DNS Server ( such as .com or .net ), which stores the informaiton for its domains. When searching for example.com, our request is pointed toward the .com TLD.

  4. The resolver then makes a .com request to the .com TLD

  5. THe TLD server then responds with the IP address of the domain's nameserver, example.com.

  6. Lastly, the recursive resolver sends a query to the domain's nameserver.

  7. The IP address for example.com is then returned to the resolver from the nameserver.

  8. The DNS resolver then responds to the web browser with the IP address of the domain requested initially.

Once the 8 steps of the DNS lookup have returned the IP address for example.com the browser is able to make the request for the webpage:

  1. The browser makes a HTTP request to the IP address

  2. The server at that IP returns the webpage to be rendered in the browser.

DNS Records

DNS records ( also zone files ) are instructions that live in authoritative DNS Server and provide information about a domain including what IP Address is associated with that domain and how to handle requests for that domain. Their records consist of a series of text files written in, what is known as DNS syntax. DNS Syntax is just a string of characters used as commands that tell the DNS server what to do. All DNS records also have a TTL ( Time To Live ), and indicates how often a DNS server will refresh that record.

Common types of DNS Records

  1. A Record: The record that holds the IP address of the domain

  2. CNAME Record: Forwards one domain or subdomain to another domain, does NOT provide an IP address

  3. AAAA Record: The record that contains the IPv6 address for a domain ( as opposed to A records, which list the IPv4 addresses ).

  4. MX Record: Directs mail to an email server.

  5. TXT Record: Let's an admin store text notes in the record. These records are often used for email security

  6. NS Record: Stores the name server for a DNS entry.

  7. SOA Record: Stores admin information about a domain.

  8. SRV Record: Provides a domain name in reverse-lookups

Sources

  1. Cloudflare - What is DNS

  2. Cloudflare - DNS Records