From Vint Cerf's "32 bits was enough" confession in 1977 to RIPE running dry in 2019 — a complete tour of IPv4 addressing. Learn classful design (A/B/C/D/E), subnet masks, the AND-with-mask trick, CIDR notation, VLSM allocation, and route aggregation through 9 fully worked numericals with animated diagrams. Includes real cases: MIT selling 8M IPs to Amazon, RIPE NCC's exhaustion, and AWS's 100-million-IP empire.
Section 01
The Address Every Device on Earth Needs
📖 A Confession from Vint Cerf
"I Thought 32 Bits Was Enough"
In 1977 a young engineer named Vint Cerf sat down with Bob Kahn to finalize the packet format for
a network they called TCP/IP. One question: how big should the address field be? They picked
32 bits — 4.3 billion possible addresses. Cerf later admitted he thought of it as
an experiment. Surely a real network would come along later. In 1977 the planet had 4.5 billion
humans and maybe 100 connected computers.
Fast-forward to 25 November 2019. At exactly 15:35 UTC+1 in Amsterdam, the RIPE NCC
— the body that hands out European IP addresses — sent out an email with the subject line
"The RIPE NCC has run out of IPv4 Addresses."
Every one of the 4,294,967,296 addresses Cerf's team had allocated in 1977 was gone. Networks that
wanted new IPs now had to buy them second-hand — MIT was selling 8 million of theirs to Amazon for
tens of millions of dollars.
That "32-bit experiment" is IPv4, and it still routes over 60% of all Internet
traffic in 2026. Understanding how it works — and how tricks like subnetting and
CIDR stretched a 32-bit address space to last 40 years past its expiry date — is the
single most important skill in networking.
📍
Where IP Lives in the Stack
IP addressing is the job of the Network Layer (Layer 3) of the OSI model.
Ethernet and WiFi (Layer 2) can only deliver a frame across one local link. IP is what
lets a packet cross fifteen networks, three continents, and one submarine cable to reach its
destination. Every router on Earth does exactly one thing: look at a packet's destination IP,
consult its routing table, and forward the packet one hop closer.
Section 02
IPv4 Address Structure — 32 Bits in Four Octets
An IPv4 address is 32 bits long. To make it human-readable, we chop it into four 8-bit chunks
called octets, convert each to decimal (0–255), and separate them with dots.
This is dotted-decimal notation.
Each octet is one byte (8 bits) → four bytes = 32 bits. The maximum decimal value per octet is 2⁸−1 = 255. Anything higher (like 300 or 256) is not a valid IP address.
💬
The Binary Trick You Must Memorise
The powers of 2 in a single octet from left (MSB) to right (LSB):
128, 64, 32, 16, 8, 4, 2, 1. Every subnetting question you'll ever answer
reduces to adding a subset of these eight numbers. Example: 192 = 128 + 64 = binary
11000000. 75 = 64 + 8 + 2 + 1 = binary 01001011.
Section 03
Classful Addressing — The Original 1981 Design
RFC 791 (1981) split the entire IPv4 address space into five classes based on the
leading bits of the first octet. This let a router decide, just by looking at the first few bits,
how many bits belonged to the "network" part vs the "host" part.
A router reads the leading bits: 0 = Class A, 10 = B, 110 = C, 1110 = D, 1111 = E. That single peek tells it how much of the address is "which network" vs "which host on that network."
Class
Leading Bits
First Octet Range
Default Mask
Networks
Hosts/Net
Intended Use
A
0xxx
1 – 126
255.0.0.0 (/8)
126
16,777,214
Giant orgs, ISPs
B
10xx
128 – 191
255.255.0.0 (/16)
16,384
65,534
Universities, large corps
C
110x
192 – 223
255.255.255.0 (/24)
2,097,152
254
Small businesses, LANs
D
1110
224 – 239
—
Multicast groups
Streaming, routing protocols
E
1111
240 – 255
—
Reserved
Research / future use
💫
Why Classful Addressing Died
Classful design was inflexible. An organization with 300 employees couldn't use a
Class C (only 254 hosts) but a Class B wasted 65,234 addresses. There was no middle ground.
By 1993 this scheme was chewing through the IPv4 pool so fast that the IETF invented
Classless Inter-Domain Routing (CIDR) in RFC 1519 — the death knell of
classes. Modern routers ignore class entirely.
Section 04
Special-Purpose IPv4 Address Ranges
Not every IPv4 address is available for a public host. Certain ranges are permanently reserved.
These are the ones every network engineer must know cold.
Range
CIDR
Class
Purpose
Routable on Internet?
10.0.0.0 – 10.255.255.255
10.0.0.0/8
A
Private network (RFC 1918)
No
172.16.0.0 – 172.31.255.255
172.16.0.0/12
B
Private network (RFC 1918)
No
192.168.0.0 – 192.168.255.255
192.168.0.0/16
C
Private network (RFC 1918) — your home router
No
127.0.0.0 – 127.255.255.255
127.0.0.0/8
A
Loopback (localhost = 127.0.0.1)
No
169.254.0.0 – 169.254.255.255
169.254.0.0/16
B
Link-local / APIPA (DHCP failure fallback)
No
100.64.0.0 – 100.127.255.255
100.64.0.0/10
A
Carrier-Grade NAT (RFC 6598) — ISPs use this to share IPs
No
0.0.0.0
0.0.0.0/32
A
"This host on this network" / default route
No
255.255.255.255
—
E
Limited broadcast (this subnet only)
No
🏠
Why Your Home WiFi Says 192.168.1.5
Your ISP gives your router one public IPv4. Inside your home, every device
(phone, laptop, smart TV) gets a private RFC 1918 address like 192.168.1.5. The router does
NAT (Network Address Translation) — rewriting outbound packets to look like they
came from its one public IP, then reversing the swap on the way back. NAT is the single biggest
reason IPv4 has survived 40 years past its designed capacity.
Section 05
Subnetting — Slicing One Network into Many
A university given the Class B network 172.16.0.0/16 has 65,534 hosts on one giant
broadcast domain — a nightmare for security, performance, and management. Subnetting
borrows bits from the host portion of the address to create smaller sub-networks.
Each subnet is a separate broadcast domain, isolated from the others by routers.
Borrow 2 host bits → those two bits create 2² = 4 combinations (00, 01, 10, 11), each identifying a subnet. Remaining 6 host bits give 2⁶ − 2 = 62 usable hosts per subnet.
The Subnetting Formulas Every Engineer Memorises
Subnets Created
2n
n = number of bits borrowed from the host portion
Usable Hosts / Subnet
2h − 2
h = remaining host bits. Subtract 2 for network address + broadcast
Block Size (increment)
256 − mask octet
Where subnet boundaries fall in the affected octet
Prefix Length
/p = default + n
/24 + 2 borrowed bits = /26
Section 06
Subnet Mask & Bitwise Logic — AND for Network, OR for Broadcast
Every subnet has two special addresses that must be computed for any given host IP: the
network address (all host bits = 0) and the broadcast address
(all host bits = 1). Two Boolean gates do all the work — the AND gate strips off
host bits to reveal the network, and the OR gate sets all host bits to reveal the
broadcast. Master these two operations and every subnet question becomes trivial.
The Two Boolean Gates You Must Memorise
🔑 AND gate — finds the NETWORK address
A
B
A AND B
0
0
0
0
1
0
1
0
0
1
1
1
📢 OR gate — finds the BROADCAST address
A
B
A OR B
0
0
0
0
1
1
1
0
1
1
1
1
🧠
One-Sentence Rules
AND rule: both inputs must be 1 to output 1 — any 0 kills the output.
OR rule: any input of 1 gives output 1 — only two 0s output 0.
Applied to IP addressing: AND with the mask preserves network bits and clears
host bits. OR with the wildcard preserves network bits and sets host bits.
Step 1 — Finding the Network Address (IP AND Subnet Mask)
The subnet mask is a 32-bit number where every network bit is 1 and
every host bit is 0. When you AND the mask with any host IP, all network bits
survive (1 AND 1 = 1) while all host bits die (host bit AND 0 = 0). What remains
is the pure network address.
Every network bit (mask = 1) passes through unchanged; every host bit (mask = 0) is forced to 0. Result: the pure network address.
Step 2 — Finding the Broadcast Address (IP OR Wildcard Mask)
The wildcard mask (also called the inverse mask) is simply the subnet
mask with every bit flipped — 1s become 0s and vice versa. For a
/26 the mask 255.255.255.192 becomes wildcard 0.0.0.63. When you OR the
wildcard with a host IP, the network bits survive unchanged (bit OR 0 = bit) while every
host bit is forced to 1 (bit OR 1 = 1). The result is the broadcast address of that subnet.
Every network bit (wildcard = 0) passes through unchanged; every host bit (wildcard = 1) is forced to 1. Result: the broadcast address, the highest number in the subnet.
Given any host IP and mask: (1) Network = IP AND mask — turns off all host
bits. (2) Broadcast = IP OR (NOT mask) — turns on all host bits. First
host = network + 1. Last host = broadcast − 1. That's the whole toolkit — memorise these
two gate operations and you can solve every subnetting numerical without a calculator.
Section 07
Subnetting Numericals — Six Worked Problems
Numerical 1 — Given IP, Find Network & Broadcast
🔢 Q: For IP 172.16.45.130 with mask 255.255.255.128 (/25), find the network, broadcast, first host, last host.
1
Mask 255.255.255.128 ⇒ last octet is 128 ⇒ borrowed 1 host bit ⇒ prefix = /25.
2
Block size in the affected octet = 256 − 128 = 128. Subnets in the last octet start at 0 and 128.
3
Host octet 130 falls between 128 and 255 ⇒ Network = 172.16.45.128.
4
Broadcast = one below the next block = 172.16.45.255.
5
First host = network + 1 = 172.16.45.129. Last host = broadcast − 1 = 172.16.45.254.
✓
Usable hosts = 2⁷ − 2 = 126. IP 172.16.45.130 is host #2 in this subnet.
Numerical 2 — Design a Subnet Plan
🔢 Q: You have 192.168.5.0/24. Split it into at least 6 subnets. Find the mask, actual number of subnets, and hosts per subnet.
1
Need ≥ 6 subnets. Solve 2n ≥ 6 ⇒ n = 3 (gives 8 subnets, 22=4 is not enough).
100 lies between 64 and 127 ⇒ belongs to 192.168.20.64/26.
3
140 lies between 128 and 191 ⇒ belongs to 192.168.20.128/26.
✓
Different subnets. Traffic between them must be routed (Layer-3 hop) — a switch alone cannot forward.
Section 08
CIDR — Classless Inter-Domain Routing
In 1993 the IETF standardised CIDR (RFC 1519), killing classes entirely. Instead of
a class deciding your prefix length, you declare it explicitly with a slash: e.g.
203.0.113.0/24 means "the first 24 bits are the network." Any prefix length from
/1 to /32 is valid. CIDR gave engineers the middle ground classful design refused to.
The slash tells the router where network ends and host begins. You can be anywhere from a /1 (2 billion hosts) to a /32 (single host) — classless.
Quick-Reference: CIDR Notation ↔ Mask ↔ Hosts
CIDR
Subnet Mask
Total Addresses
Usable Hosts
Block Size
Typical Use
/8
255.0.0.0
16,777,216
16,777,214
—
Country ISP, cloud giant
/16
255.255.0.0
65,536
65,534
—
Large campus
/22
255.255.252.0
1,024
1,022
4 in 3rd octet
Building or dept
/23
255.255.254.0
512
510
2 in 3rd octet
Floor / small campus
/24
255.255.255.0
256
254
—
Home / small office LAN
/25
255.255.255.128
128
126
128
Half a Class C
/26
255.255.255.192
64
62
64
Small dept subnet
/27
255.255.255.224
32
30
32
Team room, small VLAN
/28
255.255.255.240
16
14
16
DMZ, server segment
/29
255.255.255.248
8
6
8
Point-to-point + spares
/30
255.255.255.252
4
2
4
Router-to-router links
/31
255.255.255.254
2
2
2
Point-to-point (RFC 3021)
/32
255.255.255.255
1
1
1
Loopback / single host route
Section 09
CIDR Numericals — Five Worked Problems
Numerical 5 — Expand a CIDR Block
🔢 Q: Given 203.0.113.64/27, find network, broadcast, first host, last host, total usable hosts.
1
/27 ⇒ last 5 bits are host. Mask = 255.255.255.224.
🔢 Q: Can 192.168.4.0/24, 192.168.5.0/24, 192.168.7.0/24 (note: 6 is missing) be aggregated?
1
Binary of 3rd octets: 4=00000100, 5=00000101, 7=00000111.
2
Common prefix drops to 000001, but a /22 aggregate would also include 192.168.6.0/24 — which is not ours.
3
Advertising the /22 would tell the Internet we can reach 6.x too — a lie that black-holes traffic.
✓
Cannot cleanly aggregate. Options: advertise each /24 separately, or aggregate 4&5 into 192.168.4.0/23 and keep 192.168.7.0/24 as its own advertisement.
Numerical 8 — Data-Centre Sizing
🔢 Q: A cloud tenant has 10.50.0.0/18. How many /26 subnets fit, and how many usable hosts total?
1
Number of /26 in /18 = 2(26 − 18) = 28 = 256 subnets.
2
Each /26 has 26 − 2 = 62 usable hosts.
3
Total usable = 256 × 62 = 15,872 hosts.
✓
Note: raw /18 = 16,384 addresses. The 512-address gap is what network+broadcast reservation in each /26 costs you (2 × 256 = 512).
Section 10
VLSM — Variable Length Subnet Masking
Real networks rarely need uniform subnet sizes. Marketing has 100 hosts, Engineering has 50,
the DMZ has 12, and each router-to-router link needs exactly 2. Assigning every group a /24 would
waste thousands of addresses. VLSM uses different prefix lengths in the same
parent block, always assigning the largest requirement first.
Largest first! Marketing gets .0/25, Engineering the next available /26 (.128/26), DMZ the next /28, and the router link a /30. Always align each subnet on its own block-size boundary.
Numerical 9 — A Complete VLSM Design
🔢 Q: Allocate 172.16.0.0/22 to: Site-A 400 hosts, Site-B 200 hosts, Site-C 100 hosts, one point-to-point link.
Plan
Sort by size: Site-A (400) > Site-B (200) > Site-C (100) > P2P (2). Allocate largest first from the block start.
A
400 hosts ⇒ need /23 (510 usable). 172.16.0.0/23 → .0.0 – .1.255. Broadcast .1.255. First host .0.1. Last host .1.254.
B
200 hosts ⇒ need /24 (254 usable). Next block after /23 is at .2.0. 172.16.2.0/24.
C
100 hosts ⇒ need /25 (126 usable). Next available is .3.0. 172.16.3.0/25 → .3.0 – .3.127.
P2P
Only 2 addresses needed ⇒ /30 (2 usable). Next block boundary from .3.128 is fine. 172.16.3.128/30 → .128-.131.
✓
Everything fits inside the /22. Remaining space (172.16.3.132 – 172.16.3.255) is 124 addresses, held in reserve.
Section 11
Supernetting & Route Aggregation
Supernetting is subnetting in reverse: combining several contiguous smaller networks into one
advertisement. The Internet's Default-Free Zone (DFZ) routing table has ~1 million
IPv4 prefixes today. Without CIDR aggregation, that number would be closer to a billion and no
router on Earth could hold it in memory.
Aggregating drops 3 entries out of the routing table. Multiply this by every ISP on Earth and you understand why the modern Internet still fits in a router.
📈
The Rules for Legal Aggregation
Two conditions must both be true. (1) The networks must be contiguous —
no gaps. (2) The number of networks must be a power of 2, and the first must
align on the aggregate's block boundary. To aggregate 4 × /24 into a /22, the first /24
must start at a multiple of 4 (192.168.0, 192.168.4, 192.168.8…).
192.168.5.0 to 192.168.8.0 cannot be aggregated cleanly because 5 is not a multiple of 4.
Section 12
The IPv4 Exhaustion Crisis — Real Cases from the News
🔔
RIPE NCC Runs Out — Nov 2019
Europe's registry announced: Today, at 15:35 (UTC+1) on 25 November 2019, we made our final /22 IPv4 allocation from the last remaining addresses in our available pool. We have now run out of IPv4 addresses.
New European ISPs since then must either wait on a recovery list for at most a /24, or buy addresses on the second-hand market.
RIPE NCC official
🎓
MIT Sells 8 Million IPs
In 2017, MIT confirmed:
Fourteen million of these IPv4 addresses have not been used, and we have concluded that at least eight million are excess and can be sold without impacting our current or future needs.
Buyer: Amazon Web Services. MIT holds the original 18.0.0.0/8 block issued in RFC 739 (Nov 1977).
the 18.128.0.0/9 transfer
💵
AWS's IPv4 Empire
Analysis at Toonk.io tracked:
In 2017 MIT sold half of its 18.0.0.0/8 allocation to AWS. This 18.128.0.0/9 range holds about 8 million IPv4 addresses. In 2018 the IPv4 prefix 3.0.0.0/8 was transferred from GE to AWS.
Later: AWS paid $108 million for the AMPRnet /10 in 2019 — about $25.74 per IP. Amazon now controls roughly 100 million public IPv4 addresses.
2017 – 2020 acquisitions
🌐
Cloud Customers Hit IP Walls
AWS documentation now warns:
When pods are assigned IPv4 addresses from the VPC CIDR range, this often leads to exhaustion of the limited number of IPv4 addresses available in their VPCs.
Even inside a private cloud, RFC 1918 space runs out at Kubernetes scale — each pod eats one private IP.
EKS / pod exhaustion
🔢
Microsoft's Nortel Purchase
Historic case cited by the Internet Society:
Ironically, when Microsoft bought 667,000 IPv4 addresses in 2011 from Nortel for $7.5 million, it became headline news everywhere.
That's ~$11 per address in 2011 — today the going rate exceeds $50 per address for scarce blocks.
2011 Nortel bankruptcy
🔑
Carrier-Grade NAT (CGN)
AWS blog documents the workaround:
In this example, we assign the Carrier-Grade NAT (CGN) range 100.64.0.0/10 (RFC 6598) to the AWS environment.
Your mobile carrier likely put your phone behind a CGN too — a single public IPv4 shared among hundreds of subscribers via NAT. It buys time, but it breaks peer-to-peer and hosted services.
100.64.0.0/10 (RFC 6598)
Section 13
Golden Rules for IP Addressing & CIDR
🏆 Non-Negotiable Rules for Network Design
1
Never assign the network or broadcast address to a host. The first (all-zeros
host bits) and the last (all-ones host bits) of every subnet are reserved. A /27 has 32
addresses but only 30 usable hosts.
2
Every subnet must align on a block-size boundary. A /26 must start at 0, 64,
128, or 192 in the affected octet. Starting a /26 at .32 is not a valid subnet.
3
For VLSM, always allocate largest first. Fitting a /23 in after a /25 leaves
unusable holes. Sort your requirements descending by host count before you hand out prefixes.
4
Use RFC 1918 private space inside; NAT to public only at the edge.
10.0.0.0/8 gives 16 million addresses for free. Public IPv4 costs money and complicates
security. Save it for boundary devices only.
5
Aggregate routes wherever possible. A single /22 in a routing table beats four
/24s. This is the entire reason CIDR exists — keep the DFZ table small.
6
Plan for growth: allocate roughly 2× today's need. Renumbering hurts.
A department of 50 users should get a /26 (62 hosts), not a /27 (30 hosts) that gets
"just enough" then breaks in six months.
7
Deploy IPv6 in parallel from day one. A /48 IPv6 assignment gives 65,536
subnets each of 264 addresses. There is no IPv6 exhaustion story for the next
several centuries. Dual-stack is the responsible path.
🌈
The Whole Chapter in One Paragraph
An IPv4 address is 32 bits, split between a network part and a host part by a subnet mask.
Classful design carved fixed slices (A/B/C); it wasted so many addresses that CIDR replaced it
with slash-notation prefixes anywhere from /1 to /32. Subnetting borrows host bits to create
smaller networks; supernetting merges contiguous smaller networks for cleaner routing tables.
VLSM lets you mix prefix lengths inside one parent block so a 400-host site and a
2-host router link both fit efficiently. The whole framework has stretched a 4.3-billion
address pool to serve 30+ billion devices — and even that ran dry in 2019, which is why
IPv6 exists.