Domain Name System (DNS)
The Domain Name System (DNS) is one of the most essential β yet often overlooked components of the Internet. Itβs what allows us to use memorable names like codeharborhub.github.io instead of complex numerical IP addresses.
DNS acts as the Internetβs phonebook, translating domain names into IP addresses so browsers can locate and communicate with servers worldwide.
Why DNS Existsβ
Computers communicate using numbers (IP addresses), not words. Before DNS, users had to manually look up and remember numeric addresses β an unscalable and error-prone process.
DNS was created to solve this by introducing a distributed, hierarchical naming system thatβs:
- Human-friendly: You type names, not numbers.
- Scalable: Works across billions of domains.
- Automatic: Queries happen invisibly in milliseconds.
DNS Hierarchy Overviewβ
The DNS system is hierarchical, like a tree:
Each level plays a specific role in locating resources on the Internet.
How a DNS Query Works (Step-by-Step)β
When you enter a URL such as https://codeharborhub.github.io, your browser performs several steps to find its IP address:
All this happens in a fraction of a second.
The Four Key DNS Server Typesβ
| Server Type | Description |
|---|---|
| DNS Resolver (Recursive Resolver) | Usually provided by your ISP or a public DNS service (like Google 8.8.8.8). It initiates and manages DNS lookups on your behalf. |
| Root Name Server | The top-level of DNS β knows where to find TLD servers (like .com, .io, .net). |
| TLD Name Server | Stores information about domains under a specific top-level domain. |
| Authoritative Name Server | The final authority β provides the actual IP address for a domain. |
Common DNS Record Typesβ
DNS uses resource records (RRs) to store information. Each type serves a specific purpose:
| Record Type | Description | Example |
|---|---|---|
| A | Maps a domain to an IPv4 address. | codeharborhub.github.io β 185.199.108.153 |
| AAAA | Maps a domain to an IPv6 address. | example.com β 2606:2800:220:1:248:1893:25c8:1946 |
| CNAME | Alias for another domain name. | www.example.com β example.com |
| MX | Mail server record (used for email routing). | example.com β mail.example.com |
| TXT | Stores arbitrary text info (SPF, DKIM, verification). | v=spf1 include:_spf.google.com ~all |
| NS | Identifies the authoritative name servers for a domain. | example.com β ns1.example.net |
DNS Caching β Speed Optimizationβ
To reduce lookup time and network load, DNS results are cached at multiple levels:
- Browser Cache β Short-term memory for recently visited domains.
- Operating System Cache β Local DNS records stored temporarily.
- Resolver Cache β Managed by ISPs or public DNS resolvers.
Each record has a TTL (Time To Live) that defines how long it stays valid before a recheck.
Practical Example β DNS Lookup Flowβ
- Simple View
- Technical Flow
You type codeharborhub.github.io β DNS finds its IP β Browser connects β Website loads.
Itβs that simple β all automatic.
- The browser checks its cache.
- If not found, it asks the local resolver.
- The resolver queries root, TLD, and authoritative servers.
- The IP is returned and cached.
- The browser sends the HTTP request to that IP.
DNS in Action β Simulationβ
function DnsDemo() { const [resolved, setResolved] = React.useState(false); const resolve = () => setResolved(true); return ( <div style={{ textAlign: "center" }}> <h3>DNS Resolution Simulation</h3> <p>Domain: codeharborhub.github.io</p> <button onClick={resolve}>Resolve Domain</button> {resolved && <p> IP Address: 185.199.108.153</p>} </div> ); }
Security in DNSβ
DNS was designed for speed and reliability β not security. Attackers exploit this through methods like:
- DNS Spoofing / Cache Poisoning: Injecting false IP mappings.
- DNS Hijacking: Redirecting users to malicious servers.
- Amplification Attacks: Overloading DNS servers to cause downtime.
To counter these, DNSSEC (Domain Name System Security Extensions) was introduced. It digitally signs DNS data, ensuring authenticity and integrity.
Key Takeawaysβ
- DNS is the Internetβs distributed naming system that maps domain names to IP addresses.
- The DNS hierarchy consists of Root, TLD, and Authoritative servers.
- DNS uses various record types (A, AAAA, CNAME, MX, TXT) to manage different data.
- Caching makes DNS fast, while DNSSEC makes it secure.
- Every click, website, or API request starts with a DNS lookup β itβs the silent foundation of the web.
Learn about IP Addressing β the numerical system that identifies every device on the Internet.