Giving Every Device a Global Identity
1 The Problem We Must Solve
In the previous chapter, we learned:
- LAN communication uses MAC addresses
- But MAC addresses only work locally
- The internet connects millions of networks
So the Internet needs somethingn new:
A way to uniquely identify devices across the entire world.
A way to uniquely identify devices across the entire world.
Imagine sending a letter internatinally without addresses.
Impossible.
Networking needed a global addressing system.
This system is called:
IP Addressing
What Is an IP Address?
An IP address is:
A logical identifier assigned to a device so it can communicate across networks.
Example:
192.168.1.10Unlike MAC addresses:
| MAC Address | IP Address |
|---|---|
| Hardware-based | Logical |
| Permanent | Can change |
| Local scope | Global scope |
| Layer 2 | Layer 3 |
Why Logical Addresses?
Logical addresses allow structure.
Think of a postal address:
Country → City → Street → HouseSimilarly, IP addresses contain hierarchy.
This hierarchy allows routers to make intelligent decisions.
IPv4 Address Structure
IPv4 uses:
32 bits
Meaning:
32 binary digitsExample in binary:
11000000 10101000 00000001 00001010Humans cannot easily read binary.
So we write it in decimal form.
Dotted Decimal Notation
Each 8 bits = 1 byte (octet).
192.168.1.10Structure:
[8 bits].[8 bits].[8 bits].[8 bits]Range of each section:
0 - 255Two Parts of an IP Address
Every IP address has two logical components:
| Network Portion | Host Portion |Network Portion
Identifies which network the device belongs to.
Like a city name.
Host Portion
Identifies which device inside that network.
Like a house number.
Example:
192.168.1.10May mean:
- Network -> 192.168.1
- Host -> 10
Routers care about the network part.
Devices care about the host part.
How Does a Device Know the Split? (Subnet Mask)
A device needs instructions telling:
Which bits belong to network and which to host?
This instruction is called a:
Subnet Mask
Example:
IP Address : 192.168.1.10
Subnet Mask: 255.255.255.0What the Mask Means
Binary form:
Subnet Mask:
11111111.11111111.11111111.00000000Rule:
- 1s -> network bits
- 0s -> host bits
So:
- first 24 bits = network
- last 8 bits = host
CIDR Notation
Shortcut format:
192.168.1.10/24"/24" means first 24 bits are network.
Why Subnetting Exists
Imagine one giant network with millions of devices.
Problems:
- huge broadcasts
- slow performance
- difficult management
Solution:
Divide networks into smaller parts
This is called:
Subnetting
Example
Instead of:
192.168.1.0 (one large network)We create:
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26Now traffic stays localized.
Network scale efficiently.
Public vs Private IP Addresses
Not all IP addresses are global.
Private IP Addresses
Used inside local networks.
Ranges:
10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255Your home Wi-Fi uses these.
Not directly reachable from Internet.
Public IP Addresses
Assigned globally by ISPs.
Unique worldwide.
Used for Internet communication.
Special IP Addresses
Network Address
Represents the network itself.
Example:
192.168.1.0Broadcast Address
Sends message to all devices.
Example:
192.168.1.255Loopback Address
127.0.0.1Means:
“This computer itself.”
Used for testing networking software.
How Devices Decide Where to Send Data
When sending a packet, device asks:
Is destination inside my network?
Case 1: Same Network
Send directrly using MAC address
(No router needed.)
Case 2: Different Network
Send packet to:
Default Gateway (Router)
Router handles rest of journey.
Example – Visiting a Website
Your PC:
192.168.1.10Website server:
8.8.8.8Your PC realizes:
Not same network.
So it sends packet to router:
192.168.1.1Router forward packet toward internet.
The IPv4 Address Exhaustion Problem
IPv4 provides:
2^32 ~ 4.3 billion addressesSounded huge in 1980s
Today:
- smartphones
- laptops
- IoT devices
- servers
Addresses ran out.
Solutions:
- NAT
- IPv6 (next-generation addressing)
Layer Interaction
When sending data:
Application Data
↓
TCP Segment
↓
IP Packet (IP Address added)
↓
Ethernet Frame (MAC added)
↓
Bits on wireEach layer adds information.
This process is called encapsulation.
Leave a comment
Your email address will not be published. Required fields are marked *


