Skip to main content

DNS and IP Addresses

When you visit a website like codeharborhub.github.io, your browser doesnโ€™t actually understand the name, it only understands numbers. These numbers are called IP addresses, and the system that translates human-friendly names into them is called the Domain Name System (DNS).

What Is an IP Address?โ€‹

An IP (Internet Protocol) address is a unique identifier assigned to every device connected to the Internet. Itโ€™s like a postal address for computers, it tells other systems where to send or receive data.

Two Common Versions:โ€‹

VersionFormatExampleUsage
IPv432-bit (4 numbers separated by dots)192.168.1.1Most widely used, limited supply
IPv6128-bit (hexadecimal separated by colons)2400:cb00:2048:1::c629:d7a2Modern, supports billions of devices

What Is DNS?โ€‹

The Domain Name System (DNS) is often described as the phonebook of the Internet. It translates easy-to-remember domain names (like google.com) into machine-readable IP addresses (like 142.250.190.78).

Without DNS, youโ€™d have to memorize long strings of numbers just to visit your favorite websites.

How DNS Works โ€” Step by Stepโ€‹

Letโ€™s walk through what happens when you type https://codeharborhub.github.io into your browser:


Each lookup happens in milliseconds โ€” thatโ€™s the magic of the Internetโ€™s infrastructure.

DNS Components Explainedโ€‹

ComponentDescription
DNS ResolverThe first point of contact โ€” usually operated by your ISP or a public service (like Google DNS 8.8.8.8).
Root ServersThe highest level in DNS โ€” directs the query to the correct top-level domain (like .com, .org, .io).
TLD ServersHandle requests for specific top-level domains.
Authoritative Name ServersContain the final IP record for the domain.

Types of DNS Recordsโ€‹

Record TypePurposeExample
AMaps a domain to an IPv4 addressexample.com โ†’ 93.184.216.34
AAAAMaps a domain to an IPv6 addressexample.com โ†’ 2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias to another domainwww.example.com โ†’ example.com
MXMail server recordexample.com โ†’ mail.example.com
TXTStores text info (often for verification)v=spf1 include:_spf.google.com ~all

Real-World Analogyโ€‹

Think of DNS like asking for directions:

  • You know the name of a restaurant (domain name).
  • You ask a directory service (DNS) for its address.
  • You drive to that location (IP address).

Without DNS, youโ€™d have to remember every single street address (IP) manually.

Fun Factโ€‹

The first DNS system was invented in 1983 by Paul Mockapetris, replacing a single centralized text file (hosts.txt) that originally stored all Internet addresses!

DNS and Securityโ€‹

Since DNS is critical to Internet functionality, itโ€™s also a target for attacks like:

  • DNS Spoofing (Cache Poisoning): Fake responses redirect users to malicious sites.
  • DNS Hijacking: Attackers modify DNS settings to steal traffic.

To mitigate this, technologies like DNSSEC (Domain Name System Security Extensions) ensure authenticity and integrity of DNS responses.

Quick Demoโ€‹

Live Editor
function DnsLookupDemo() {
  const [ip, setIp] = React.useState("");
  const lookup = () => setIp("185.199.108.153");
  return (
    <div style={{ textAlign: "center" }}>
      <h3>DNS Lookup Simulation</h3>
      <p>Domain: codeharborhub.github.io</p>
      <button onClick={lookup}>Resolve Domain</button>
      {ip && <p> IP Address: {ip}</p>}
    </div>
  );
}
Result
Loading...

Key Takeawaysโ€‹

  • IP addresses identify devices; DNS translates names to addresses.
  • The DNS process involves resolvers, root servers, TLD servers, and authoritative servers.
  • Common record types: A, AAAA, CNAME, MX, TXT.
  • DNSSEC helps secure DNS lookups from tampering.
  • Every website you visit goes through a DNS lookup first โ€” itโ€™s the Internetโ€™s invisible phonebook.

โ€œEvery website starts with a name, but itโ€™s DNS that tells your browser where that name truly lives.โ€