How DNS Works (Domain Name System)?
How DNS Works (Domain Name System)?
The Domain Name System (DNS) translates human-readable domain names (like example.com) into IP addresses that computers use to communicate. It’s often described as the “phone book” or “directory” of the internet.
At a high level, a DNS lookup involves your device asking a resolver to find the IP address for a domain, the resolver querying a hierarchy of DNS servers (root, TLD, authoritative), and then returning the answer, which is cached for performance.
DNS lookup process
- Your application asks the OS to resolve a name; the stub resolver sends a query to the configured recursive resolver.
- If the resolver doesn’t have a cached answer, it starts at the root.
- Root servers return a referral to the appropriate TLD servers (e.g., .com).
- The resolver queries the TLD servers, which return a referral to the domain’s authoritative servers.
- The resolver queries the authoritative server, which replies with the record (e.g., an A or AAAA record).
- The resolver returns the answer to your device and caches it per TTL.
DNS Record types
- A Records : IPv4 address mapping.
- AAAA Records : IPv6 address mapping.
- CNAME Records : Alias to another name.
- NS Records : Delegates part of the namespace to authoritative servers.
- MX Records : Mail exchange servers.
- TXT Records : Arbitrary text; often for SPF, DKIM, etc.
Note : DNS responses are cached to reduce latency and load. Each record includes a Time To Live (TTL), after which it must be re-queried.
Note: The DNS namespace is divided into zones. A parent zone delegates authority for a subdomain to child zone name servers via NS records (and glue when necessary).
Note: The DNS namespace is divided into zones. A parent zone delegates authority for a subdomain to child zone name servers via NS records (and glue when necessary).
Example (www.thenetworkdna.com)
- Your browser asks the OS to resolve www.example.com.
- The stub resolver sends a recursive query to 8.8.8.8 (example).
- 8.8.8.8 queries a root server, which replies with .com TLD servers.
- It queries a .com TLD server, which replies with NS records for www.thenetworkdna.com.
- It queries the example.com authoritative server, which replies with an A record: X.X.X.X.
- The resolver caches the response for its TTL and returns it to your device.