The Network Layer (Layer 3) is responsible for end-to-end delivery across multiple networks. The IP address is the logical identifier that makes this possible.
IPv4 Structure
32-bit address written as four decimal octets: 192.168.1.1
| Bits | 0-7 | 8-15 | 16-23 | 24-31 |
|---|---|---|---|---|
| Octet | 192 | 168 | 1 | 1 |
Every IP address has two parts:
- Network ID — identifies the network segment
- Host ID — identifies the specific device on that network
The boundary between network and host is determined by the subnet mask (e.g., 255.255.255.0 = 24 network bits, 8 host bits).
Public vs Private IP Addresses
Private IP ranges (defined in RFC 1918, not routable on the internet):
| Range | CIDR | Use |
|---|---|---|
10.0.0.0 – 10.255.255.255 | /8 | Large enterprise networks |
172.16.0.0 – 172.31.255.255 | /12 | Medium networks |
192.168.0.0 – 192.168.255.255 | /16 | Home/Small office (default for most routers) |
Public IPs are globally unique and assigned by ISPs. Private IPs are reusable across networks — billions of home routers use 192.168.1.x.
Special Addresses
| Address | Purpose |
|---|---|
127.0.0.1 (localhost) | Loopback — test the local network stack |
0.0.0.0 | Default route / “all addresses” |
255.255.255.255 | Limited broadcast |
| Network address (host bits all 0) | Identifies the network itself |
| Broadcast address (host bits all 1) | All devices on the network |
Q: Why do we need public IP addresses?
A: Public IPs are globally unique and routable on the internet. Any server providing services must have a public IP so clients worldwide can reach it.
Q: What is the benefit of using private IP addresses?
A: Address reuse — the same 192.168.1.x can be used in millions of homes without conflict. Also security — private IPs are not directly reachable from the internet (they require NAT).
Q: What are the two parts of an IP address?
A: The Network ID (identifies the subnet) and the Host ID (identifies the specific device). The subnet mask defines the boundary between them.
Premium Content
Unlock IP Addressing (IPv4) and all premium lessons with a subscription.
From ₹199.99/year — See plans