How DNS Translates Domain Names to IP Addresses: A Complete Guide
This article explains why web browsers use domain names instead of IP addresses, how the DNS system automatically resolves those names through a hierarchical namespace, the roles of hosts files, root and authoritative servers, query types, transport protocols, and practical lookup examples.
Hosts file
Before DNS, each computer used a local hosts file to map hostnames to IP addresses. This method is fast but requires manual updates on every machine, which becomes impractical as the network grows.
DNS Overview
DNS (Domain Name System) is a client‑server system that automatically translates domain names into IP addresses. A DNS client sends a query to a DNS server, which replies with the requested address. On Windows the command nslookup hostname can be used to test the lookup.
Domain name structure
A fully qualified domain name (FQDN) is a dot‑separated hierarchy. The right‑most label is the top‑level domain (e.g., cn), followed by second‑level ( edu), third‑level ( tsinghua), and finally the host label ( www). An FQDN ends with a trailing dot.
DNS namespace
The namespace forms an inverted tree: root → top‑level domains → second‑level domains → … Each zone is managed by a DNS server. Root servers know the addresses of TLD servers; TLD servers know the addresses of second‑level servers, and so on.
Server types
Root name servers : 13 globally distributed servers that delegate to TLD servers.
Top‑level domain (TLD) servers : manage country‑code, generic, and sponsored TLDs.
Authoritative name servers : store the actual records for a domain. Primary (master) servers hold the master zone file; secondary (slave) servers obtain copies via zone transfers.
Recursive resolvers (often provided by ISPs): receive client queries and perform the full lookup process on behalf of the client.
Resolution process
Client sends a query for www.tsinghua.edu.cn to its recursive resolver.
If the resolver’s cache lacks the record, it queries a root server.
The root server returns the address of the cn TLD server.
The resolver asks the cn server, which points to edu.cn.
The resolver queries edu.cn, which points to tsinghua.edu.cn.
The tsinghua.edu.cn server returns the final IP address.
The resolver caches the result and returns it to the client.
Transport protocols
DNS uses UDP port 53 for typical queries. If a response exceeds 512 bytes, the server sets the TC flag and the client retries over TCP. Zone transfers between primary and secondary servers always use TCP.
Recursive vs. iterative queries
In a recursive query the DNS server continues contacting other servers until it obtains the final answer and returns it to the client. In an iterative query the server returns a referral (the address of another server) and the client proceeds with the next lookup.
Reverse lookup
Reverse DNS maps an IP address to a domain name using the special in-addr.arpa zone, where the octets of the address are reversed.
Static and dynamic resolution
Static resolution relies on a local table (similar to the hosts file). Dynamic resolution uses dedicated DNS servers that respond to client queries, allowing centralized management of name‑to‑address mappings.
DNS proxy
A DNS proxy forwards client queries to an upstream DNS server after checking its own cache. This simplifies configuration changes because only the proxy needs to be updated when upstream DNS servers change.
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.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
