How DNS Works: From Domain Names to IP Addresses Explained
This article explains the DNS system, its hierarchical structure, the roles of root, TLD, and authoritative servers, common resource record types, and the three kinds of DNS queries—recursive, iterative, and reverse—illustrated with examples and diagrams.
DNS (Domain Name System) translates IP addresses to hostnames and vice‑versa, acting as a massive distributed database that stores mappings between domain names and IP addresses along with other related information.
DNS Structure
DNS uses a hierarchical, tree‑like naming scheme. At the top is the root (represented by a dot “.”), followed by top‑level domains (TLDs), then second‑level domains and any number of subdomains separated by dots.
Top‑level domains are of two types:
gTLD – generic top‑level domains such as .com, .org, .edu, .net.
ccTLD – country‑code top‑level domains such as .cn, .in, .uk, .ru.
Authority, Delegation, and Zones
Root and gTLD authority is managed by ICANN, while ccTLDs are delegated to individual countries. Each level in the hierarchy can delegate authority to the next lower level, and each level runs its own DNS server responsible for its zone.
For example, when a query for www.example.com reaches the root, the root delegates to the .com TLD server, which delegates to the example.com server that finally returns the IP address for www.
A zone contains the DNS data for a portion of the domain tree. The zone for example.com includes records for the domain itself and may delegate subdomains to other authoritative servers.
Resource Records
Zones are composed of resource records, each providing specific information about an object. Common record types include:
A record: maps a hostname to its IPv4 address.
PTR record: maps an IP address to a hostname (reverse lookup).
NS record: specifies the authoritative name servers for a domain.
MX record: lists mail exchange servers for a domain.
You can query these records using tools like dig.
DNS Queries
DNS queries ask for information such as “What is the IP address of a.example.com?”. There are three query types:
Recursive query
Iterative query
Reverse query
In a recursive query, a host asks its local DNS server for a.example.com. If the server lacks the answer, it queries the root, then the .com TLD server, then the example.com authoritative server, which finally returns the A record.
In an iterative query, if a DNS server does not know the answer, it refers the client to another DNS server, and the client continues the lookup.
In a reverse query, an IP address is provided and the system returns the associated hostname.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
