Chapter 03 — IP Addressing (IPv4, IPv6, Subnets)
Chapter 03 — IP Addressing (IPv4, IPv6, Subnets)
Hey everyone! Welcome back to Namaste Computer Networks! 🙏
Every device on a network needs a unique address so data can find it — that's the IP address. It seems simple until you meet IPv6, private vs public addresses, subnets, and NAT. Let's untangle all of it with clear pictures, because "how does my laptop have an address?" is a very common interview starter.
What we will cover:
- What an IP address is (IPv4 format)
- IPv4 vs IPv6 (and why IPv6 exists)
- Public vs private addresses
- NAT — how many devices share one public IP
- Subnets in plain English
- Interview Questions
1. What Is an IP Address?
An IPv4 address = 4 numbers (0–255) separated by dots:
192.168.1.10
└┬┘ └┬┘ └┬┘ └┬┘
each is one "octet" (8 bits) → 32 bits total
32 bits → about 4.3 BILLION possible addresses. Sounds like a
lot... but there are far more than 4.3 billion devices now.
That shortage is exactly why IPv6 was created.
2. IPv4 vs IPv6
| IPv4 | IPv6 | |
|---|---|---|
| Size | 32 bits | 128 bits |
| Format | 192.168.1.10 (dotted decimal) | 2001:0db8:85a3::8a2e:0370:7334 (hex, colons) |
| Total addresses | ~4.3 billion | ~340 undecillion (basically unlimited) |
| Why | Original, running out | Solves exhaustion; also simpler routing |
IPv6 has SO many addresses that every grain of sand on Earth could have billions. We'll never run out. It's slowly rolling out alongside IPv4 (they coexist).
3. Public vs Private Addresses
┌─────────────────────────────────────────────────────────────┐ │ PUBLIC IP → unique on the WHOLE internet. Given to your │ │ home router by your ISP. Reachable globally. │ │ │ │ PRIVATE IP → unique only within your LOCAL network. Your │ │ laptop, phone, TV each get one. NOT reachable │ │ directly from the internet. │ └─────────────────────────────────────────────────────────────┘
Private ranges (reserved, reused in every home/office):
10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255 ← the classic home one
Your phone might be 192.168.1.5 AND so might a phone in another
house — that's fine, because private IPs are only unique LOCALLY.
4. NAT — Sharing One Public IP
Your home has ONE public IP but MANY devices. How do they all reach the internet? Network Address Translation (NAT), done by your router.
Home devices (private) Router Internet
┌──────────────────┐ (sees only the
│ laptop 192.168.1.5│──┐ public IP)
│ phone 192.168.1.6│──┼──▶ [ NAT router ] ──▶ 203.0.113.7
│ TV 192.168.1.7│──┘ public: 203.0.113.7
└──────────────────┘
The router REWRITES the source address: outgoing packets appear
to come from the ONE public IP. It keeps a table so replies get
routed back to the right internal device.
→ This is a big reason IPv4 hasn't fully run out: thousands of
devices can hide behind a single public IP via NAT.
5. Subnets in Plain English
An IP address has TWO parts:
• NETWORK part → which network you're on
• HOST part → which specific device on that network
A SUBNET MASK says where the split is:
192.168.1.10 / 24 ("/24" = first 24 bits are the network)
→ network: 192.168.1.___ host: ___.10
→ this subnet holds 192.168.1.0 to 192.168.1.255
Analogy: a phone number. The area code = the network (which
city), the rest = the specific line (which device). Subnetting
is drawing the line between "area code" and "local number."
WHY SUBNET? To split a big network into smaller, organized,
isolated groups — for security, and so routers can forward
efficiently ("everyone in 192.168.1.x → send that way").
Interview Questions — Quick Fire!
Q: What is an IP address?
"An IP address is a unique identifier for a device on a network, used to route data to it. IPv4 addresses are 32 bits, written as four numbers from 0 to 255 separated by dots, like 192.168.1.10. It has a network portion identifying which network the device is on and a host portion identifying the specific device."
Q: Why was IPv6 introduced?
"Because IPv4's 32-bit addresses provide only about 4.3 billion addresses, which isn't enough for the number of connected devices today. IPv6 uses 128-bit addresses, giving a practically unlimited supply, and also simplifies routing. IPv4 and IPv6 currently coexist during the gradual transition."
Q: What's the difference between a public and a private IP address?
"A public IP is globally unique and reachable across the whole internet — your ISP assigns one to your router. A private IP is unique only within a local network and isn't directly reachable from the internet; devices like your laptop and phone get private IPs from reserved ranges like 192.168.x.x. The same private addresses are reused in many networks because they only need to be unique locally."
Q: What is NAT?
"Network Address Translation lets many devices with private IP addresses share a single public IP. The router rewrites the source address of outgoing packets so they appear to come from the one public IP, and keeps a translation table to route replies back to the correct internal device. NAT is a major reason IPv4 addresses haven't been fully exhausted."
Q: What is a subnet and a subnet mask?
"A subnet is a logical subdivision of a network. An IP address has a network part and a host part, and the subnet mask defines where the split is — for example /24 means the first 24 bits are the network portion. Subnetting divides a large network into smaller, organized, isolated groups, which improves security and lets routers forward traffic more efficiently."
Key Points to Remember
| Concept | Key Takeaway |
|---|---|
| IP address | Unique device address. IPv4 = 32 bits (~4.3B), dotted decimal. |
| IPv6 | 128 bits, virtually unlimited — solves IPv4 exhaustion. |
| Public vs private | Public = global & unique · Private = local-only, reused (192.168.x.x). |
| NAT | Router maps many private IPs to one public IP; keeps a translation table. |
| Subnet | Split of network vs host part (via mask, e.g. /24). Organizes & isolates. |
What's Next?
We can now address devices. But how does data actually travel between them — reliably or fast? Season 2 opens with the great rivalry of the Transport layer: Chapter 04, TCP vs UDP.
Keep learning, keep connecting! See you in the next one!
Post a Comment