| |

LFCE 7 ๐Ÿง IP Addressing โ€” Classful vs Classless

โฑ๏ธ Estimated read: 13 min | |

IPv4 addressing has undergone exactly one fundamental architectural change in its history: the transition from classful to classless routing. Before 1993, every address carried its class in its first octet. A router could look at a packet’s destination and know, without any additional configuration, whether the network portion was 8, 16, or 24 bits long. This design was elegant in its simplicity and catastrophic in its consequences. It wasted address space at an industrial scale, and it threatened to exhaust router memory before it exhausted the address pool itself. Classless Inter-Domain Routing, introduced by the IETF in 1993, replaced fixed class boundaries with a variable-length mask carried in routing protocols . The mask could now be any length, allowing an organization with 800 hosts to receive a 10-bit prefix instead of an entire 16-bit Class B .

For the LFCE candidate, this distinction is not historical trivia. The networking objectives require configuring a system to route IP traffic dynamically . Every routing daemon you configureโ€”FRR, BIRD, Quaggaโ€”operates in a classless world. Every prefix you advertise with OSPF or BGP carries an explicit mask. Understanding why classful addressing failed is the foundation for understanding why the tools you configure look the way they do.

Key point: Classful addressing derived the network length from the first octet’s value. Classless addressing carries the network length as an explicit prefix or mask. A router in a classful world needed no mask configuration; a router in a classless world cannot function without one.


Why classless replaced classful

The address waste problem.

Classful addressing offered exactly three sizes of network: Class A with 16,777,216 addresses, Class B with 65,536, and Class C with 256 . An organization needing 800 hosts had two unacceptable choices. It could request a Class B and waste over 64,000 addresses, or it could request multiple Class C networks and multiply its routing entries . The first choice accelerated IPv4 exhaustion. The second choice accelerated routing table growth. There was no middle path. Classless addressing introduced variable-length subnet masking, allowing allocations of any size on any bit boundary. An 800-host organization could receive a /22โ€”1,024 addressesโ€”wasting only 224 instead of 64,000 .

The routing table explosion problem.

Every active classful network required a separate entry in every router’s table. There was no way to aggregate a group of Class C networks into a single route, because the class boundaries did not align with the aggregation boundaries. As the internet grew, router memory became the binding constraint before address exhaustion did. Classless addressing solved this through prefix aggregation: a service provider could receive a large contiguous block and subdivide it among customers, advertising only the aggregate to the global routing table . A /16 aggregate could represent 256 /24 customer networks, reducing 256 routing entries to one.

The subnetting limitation problem.

Subnetting existed under classful addressing, but it was a local technique. A Class B network could be divided into smaller subnets internally, but the outside world still saw a single Class B route. The division between network and host was visible only to routers connected to the collection of networks designated by the network part . Classless addressing extended this flexibility to the global routing system. The mask traveled with the route, so the network/host boundary was no longer a local secret. It became a universal, explicit property of every prefix.


a. Classful addressing โ€” fixed boundaries by first octet

Classful addressing divides the IPv4 space into five classes based on the leading bits of the address. Classes A, B, and C are unicast; D is multicast; E is reserved . The class determines both the default subnet mask and the number of available networks and hosts.

# Classful address identification by first octet
# Class A: 1-126, default mask /8 (255.0.0.0)
#   First bit is 0; network is 8 bits; host is 24 bits
# Class B: 128-191, default mask /16 (255.255.0.0)
#   First two bits are 10; network is 16 bits; host is 16 bits
# Class C: 192-223, default mask /24 (255.255.255.0)
#   First three bits are 110; network is 24 bits; host is 8 bits
# Class D: 224-239, multicast; no default mask
# Class E: 240-254, experimental; no default mask

# Example: 10.20.30.40 is Class A because 10 is in 1-126
# The network is 10.0.0.0/8 and the host is 20.30.40

The class is embedded in the address itself. No mask needs to be configured; the router derives it from the first octet. A Class A address has 126 possible networks (0 and 127 are reserved), each with 16,777,214 usable hosts. A Class B has 16,384 networks with 65,534 hosts each. A Class C has 2,097,152 networks with 254 hosts each .

# Classful routing table entry (conceptual)
# A router knows 10.0.0.0 is Class A, so the mask is implicitly /8
# No mask is transmitted in the routing update
# The destination 10.20.30.40 matches 10.0.0.0 because the first 8 bits match

This implicitness was the classful system’s defining feature. It was also its fatal flaw: the mask could not be anything other than 8, 16, or 24. There was no mechanism to advertise a /22 or a /30.


b. Classless addressing โ€” explicit masks and CIDR notation

Classless addressing removes the class concept entirely. Every route carries an explicit mask or prefix length, and the network/host boundary can fall on any bit position . The mask is a 32-bit value where 1-bits represent network bits and 0-bits represent host bits.

# Classless routing table entries on a Linux router
# Each route carries an explicit prefix length
ip route add 192.168.0.0/24 via 10.0.0.1      # A /24: 24 network bits, 8 host bits
ip route add 192.168.4.0/22 via 10.0.0.2      # A /22: 22 network bits, 10 host bits
ip route add 10.10.10.0/30 via 10.0.0.3       # A /30: 30 network bits, 2 host bits

The prefix length is not derived from the address. It is configured and advertised. A router receiving a route for 192.168.4.0/22 knows, because the mask is explicitly attached, that the first 22 bits identify the network. Without that mask, it would have no way to determine the boundary.

# CIDR notation expresses the prefix length after a slash
# 192.168.4.0/22 covers the address range:
#   192.168.4.0 through 192.168.7.255
# The /22 mask in dotted decimal is 255.255.252.0
# The first 22 bits are 1s: 11111111.11111111.11111100.00000000

CIDR notationโ€”the slash and decimal prefix lengthโ€”has become the universal syntax for classless addressing. It appears in routing daemon configurations, firewall rules, and interface assignments because it is compact and unambiguous.


c. Aggregation and subnetting under classless routing

Classless addressing enables two operations that classful addressing could not perform globally: supernetting (aggregation) and arbitrary subnetting. Aggregation reduces the global routing table by combining contiguous prefixes into a single advertisement. Subnetting divides an allocation into smaller pieces without changing the external advertisement.

# Aggregation: four /24 networks combined into one /22 advertisement
# 192.168.4.0/24, 192.168.5.0/24, 192.168.6.0/24, 192.168.7.0/24
# All share the first 22 bits: 192.168.4.0/22
# A router advertising the /22 covers all four /24s with one entry

# On a Linux router, the aggregate route is configured once:
ip route add 192.168.4.0/22 via 10.0.0.1
# More specific routes (the /24s) still exist internally but need not be advertised

Subnetting under classless addressing works the same way, but without the class constraint. A /16 allocation can be divided into /20 subnets, then further into /24s, then into /30 point-to-point links, all within the same address space, all advertised with their explicit masks.

# Subnetting a /22 into four /24s for different departments
# The /22 is 192.168.4.0/22 (mask 255.255.252.0)
# Subnets:
ip route add 192.168.4.0/24 via 10.0.0.10    # Department A
ip route add 192.168.5.0/24 via 10.0.0.11    # Department B
ip route add 192.168.6.0/24 via 10.0.0.12    # Department C
ip route add 192.168.7.0/24 via 10.0.0.13    # Department D
# The outside world sees only 192.168.4.0/22; the /24s are internal

The key difference from classful subnetting is that the external advertisement can now reflect the actual allocation size. An organization with a /22 advertises a /22, not a /16.


Complete Example Session

# ============================================
# PART 1: CLASSFUL ADDRESS IDENTIFICATION
# ============================================
# Determine the class and default mask from the first octet
# 10.1.2.3: first octet 10, Class A, implicit /8, host = 1.2.3
# 172.16.5.4: first octet 172, Class B, implicit /16, host = 5.4
# 192.168.1.1: first octet 192, Class C, implicit /24, host = 1
# No mask configuration is needed; the class supplies it

# ============================================
# PART 2: THE WASTE OF CLASSFUL ALLOCATION
# ============================================
# An organization needs 800 hosts.
# Class C gives 254 hosts: insufficient.
# Class B gives 65,534 hosts: 64,734 wasted.
# Classful addressing cannot express "approximately 800 addresses."
# The only alternatives are waste or multiple Class C routes.

# ============================================
# PART 3: CLASSLESS ALLOCATION WITH CIDR
# ============================================
# A /22 prefix provides 1,022 usable addresses (1,024 minus network and broadcast)
# 192.168.4.0/22 covers 192.168.4.0 through 192.168.7.255
# This is close to the 800-host requirement with minimal waste
# The prefix length (22) is explicit; it is not derived from the first octet

# ============================================
# PART 4: CONFIGURING CLASSLESS ROUTES ON LINUX
# ============================================
# Linux routing tables are inherently classless
ip route add 192.168.4.0/22 via 10.0.0.1     # Aggregate route for the /22
ip route add 192.168.5.0/24 via 10.0.0.10    # More specific route within the /22
# The /24 is a longer prefix and will be preferred for 192.168.5.0/24 traffic
# This is classless longest-prefix matching in action

# ============================================
# PART 5: VERIFYING LONGEST-PREFIX MATCH
# ============================================
ip route get 192.168.5.50
# Output shows the /24 route via 10.0.0.10 because /24 is longer than /22
ip route get 192.168.6.50
# Output shows the /22 route via 10.0.0.1 because no /24 covers .6.x

# ============================================
# PART 6: AGGREGATION FOR ROUTING TABLE REDUCTION
# ============================================
# Four contiguous /24 networks can be advertised as one /22
# Without aggregation: four routing entries in every router
# With aggregation: one routing entry
# The /22 is the supernet; the /24s are the components
# Aggregation requires contiguous allocation on bit boundaries

# ============================================
# PART 7: CLASSLESS SUBNETTING INSIDE AN ALLOCATION
# ============================================
# Divide the /22 into four /24 subnets for internal use
# The external advertisement remains 192.168.4.0/22
# Internal routers carry the more specific /24 routes
ip route add 192.168.4.0/24 via 10.0.0.10
ip route add 192.168.5.0/24 via 10.0.0.11
ip route add 192.168.6.0/24 via 10.0.0.12
ip route add 192.168.7.0/24 via 10.0.0.13

# ============================================
# PART 8: THE /30 FOR POINT-TO-POINT LINKS
# ============================================
# Classless addressing allows a /30 for a router-to-router link
# A /30 provides exactly 2 usable addresses: one for each end
# Under classful addressing, a point-to-point link needed a Class C (/24)
# wasting 252 addresses
ip addr add 10.0.0.1/30 dev eth0
ip addr add 10.0.0.2/30 dev eth1

# ============================================
# PART 9: ROUTING PROTOCOL MASK PROPAGATION
# ============================================
# Dynamic routing protocols carry the mask in their updates
# OSPF and BGP advertise prefixes with explicit lengths
# A BGP update for 192.168.4.0/22 includes the /22 in the NLRI
# A classful protocol would advertise only the class, losing the mask
# This is why modern routing requires classless protocols

# ============================================
# PART 10: CLASSFUL VS CLASSLESS SUMMARY IN PRACTICE
# ============================================
# Classful: mask implicit in first octet; no mask in updates; wasteful
# Classless: mask explicit in every route; mask carried in updates; efficient
# Every Linux route is classless; the classful world is historical
# The LFCE engineer configures classless routing exclusively

The ten parts traced the transition from classful identification through classless configuration, demonstrating longest-prefix matching, aggregation, and the /30 point-to-point link that classful addressing could not express efficiently.


Quick Reference

Classful Address Ranges

ClassFirst OctetDefault MaskPrefixNetworksHosts per Network
A1โ€“126255.0.0.0/812616,777,214
B128โ€“191255.255.0.0/1616,38465,534
C192โ€“223255.255.255.0/242,097,152254
D224โ€“239Multicastโ€”โ€”โ€”
E240โ€“254Experimentalโ€”โ€”โ€”

Classful vs Classless

PropertyClassfulClassless
Mask sourceDerived from first octetExplicit in route/update
Possible prefix lengths8, 16, 24 onlyAny length 0โ€“32
Routing update contentNetwork address onlyNetwork address + mask
AggregationNot possible across classesPossible on bit boundaries
Address efficiencyLow (large waste)High (right-sized)

Common CIDR Prefixes

PrefixMaskUsable HostsTypical Use
/30255.255.255.2522Point-to-point link
/29255.255.255.2486Small subnet
/24255.255.255.0254Department LAN
/22255.255.252.01,022Medium allocation
/16255.255.0.065,534Large allocation

Best Practices

โœ… Do This:

# Always use explicit prefix lengths in routes
ip route add 192.168.0.0/24 via 10.0.0.1              # โœ…
# Aggregate contiguous prefixes when possible
ip route add 192.168.4.0/22 via 10.0.0.1              # โœ…
# Use /30 or /31 for point-to-point links
ip addr add 10.0.0.1/30 dev eth0                      # โœ…
# Verify longest-prefix match when routes overlap
ip route get 192.168.5.50                             # โœ…
# Use CIDR notation consistently in documentation
# The /22 allocation covers 192.168.4.0โ€“7.255          # โœ…
# Advertise aggregates to reduce routing table size
# OSPF: area range 192.168.4.0 255.255.252.0            # โœ…

โŒ Don’t Do This:

# Assume a mask from the first octet
# 192.168.1.0 is not necessarily a /24 in a classless world  # โŒ
# Waste a /24 on a point-to-point link
ip addr add 10.0.0.1/24 dev eth0                      # โŒ
# Advertise every /24 individually when an aggregate exists
# Four /24 advertisements instead of one /22            # โŒ
# Ignore the mask in routing protocol configuration
# A prefix without a mask is meaningless in OSPF/BGP    # โŒ
# Use classful terminology in modern configurations
# "Class C network" is imprecise; "a /24" is correct     # โŒ
# Assume aggregation works without contiguous allocation
# Non-contiguous /24s cannot be summarized               # โŒ

Common Pitfalls

PitfallWhy It HappensFix
Route not matching expected trafficLonger prefix exists elsewhereUse ip route get to verify selected route
Aggregation missingAllocations not contiguousRequest contiguous blocks from upstream
Point-to-point link wastes addresses/24 used instead of /30Use /30 or /31 for router links
OSPF/BGP advertisement lacks maskProtocol misconfigurationVerify network statements include prefix length
Subnet overlap between sitesNo central allocation planDocument and coordinate address space
Classful assumption in troubleshootingFirst octet misleadingAlways check the configured mask

Real-World Examples

1. Classful waste: 800 hosts in a Class B

# Class B allocation: 65,534 addresses for 800 hosts
# Waste: 64,734 addresses
# The correct classless allocation: 192.168.4.0/22 (1,022 hosts)

2. Classless allocation: right-sized prefix

ip route add 192.168.4.0/22 via 10.0.0.1
# 1,024 total addresses, 1,022 usable

3. Point-to-point /30

ip addr add 10.0.0.1/30 dev eth0
# Two usable addresses: 10.0.0.1 and 10.0.0.2

4. Longest-prefix match

ip route add 192.168.0.0/16 via 10.0.0.1
ip route add 192.168.5.0/24 via 10.0.0.2
ip route get 192.168.5.10    # Matches the /24, not the /16

5. Aggregate advertisement

# OSPF area range: advertise one /22 for four /24s
# area 0 range 192.168.4.0 255.255.252.0

6. Classful identification (historical)

# First octet 10 โ†’ Class A โ†’ implicit /8
# First octet 172 โ†’ Class B โ†’ implicit /16
# First octet 192 โ†’ Class C โ†’ implicit /24

7. Classless subnetting

# Divide a /22 into four /24s
ip route add 192.168.4.0/24 via 10.0.0.10
ip route add 192.168.5.0/24 via 10.0.0.11

8. Verify mask on interface

ip addr show eth0 | grep inet
# Output includes the prefix length: 192.168.1.5/24

9. BGP aggregate

# Advertise 192.168.4.0/22 summary-only
# Suppresses the component /24s

10. Route lookup with explicit mask

ip route get 192.168.6.50
# Output: 192.168.6.50 via 10.0.0.1 dev eth0
# The /22 route matched because no /24 covered .6.x

Visual

Classful Address Space

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CLASSFUL: THE MASK IS DERIVED FROM THE FIRST OCTET          โ”‚
โ”‚                                                              โ”‚
โ”‚  Class A (0xxxxxxx)  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚  First octet 1-126    Network: 8 bits    Host: 24 bits       โ”‚
โ”‚  Mask: 255.0.0.0      โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚                                                              โ”‚
โ”‚  Class B (10xxxxxx)  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚  First octet 128-191  Network: 16 bits   Host: 16 bits       โ”‚
โ”‚  Mask: 255.255.0.0    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚                                                              โ”‚
โ”‚  Class C (110xxxxx)  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚  First octet 192-223  Network: 24 bits   Host: 8 bits        โ”‚
โ”‚  Mask: 255.255.255.0  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚
โ”‚                                                              โ”‚
โ”‚  The boundary is fixed by the class. No mask is transmitted. โ”‚
โ”‚  A /22 does not exist. A /30 does not exist.                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Classless Prefix Lengths

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CLASSLESS: THE MASK IS EXPLICIT AND VARIABLE                โ”‚
โ”‚                                                              โ”‚
โ”‚  192.168.4.0/22                                              โ”‚
โ”‚  โ”œโ”€ Network bits: 22 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                     โ”‚
โ”‚  โ””โ”€ Host bits: 10 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                            โ”‚
โ”‚                                                              โ”‚
โ”‚  Mask: 11111111.11111111.11111100.00000000                   โ”‚
โ”‚        255  .  255  .  252  .  0                             โ”‚
โ”‚                                                              โ”‚
โ”‚  The /22 is part of the route. It is advertised with the     โ”‚
โ”‚  prefix. Any length from /0 to /32 is valid.                 โ”‚
โ”‚                                                              โ”‚
โ”‚  /30: 255.255.255.252  โ†’  2 usable hosts (point-to-point)    โ”‚
โ”‚  /24: 255.255.255.0    โ†’  254 usable hosts (LAN)             โ”‚
โ”‚  /22: 255.255.252.0    โ†’  1,022 usable hosts (allocation)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Aggregation and Longest-Prefix Match

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ROUTING DECISION WITH OVERLAPPING PREFIXES                  โ”‚
โ”‚                                                              โ”‚
โ”‚  Routing table:                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                      โ”‚
โ”‚  โ”‚ 192.168.0.0/16      โ”‚ via 10.0.0.1 โ”‚  โ† Less specific     โ”‚
โ”‚  โ”‚ 192.168.5.0/24      โ”‚ via 10.0.0.2 โ”‚  โ† More specific     โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ”‚
โ”‚                                                              โ”‚
โ”‚  Packet to 192.168.5.10:                                     โ”‚
โ”‚    Matches /16 (first 16 bits: 192.168)                      โ”‚
โ”‚    Matches /24 (first 24 bits: 192.168.5)                    โ”‚
โ”‚    /24 is longer โ†’ selected: via 10.0.0.2                    โ”‚
โ”‚                                                              โ”‚
โ”‚  Packet to 192.168.6.10:                                     โ”‚
โ”‚    Matches /16 only (192.168.6 โ‰  192.168.5)                  โ”‚
โ”‚    /16 selected: via 10.0.0.1                                โ”‚
โ”‚                                                              โ”‚
โ”‚  Longest prefix wins. This is the core of classless routing.โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

ItemValue
Classful addressingMask derived from first octet; only /8, /16, /24 possible
Classless addressingMask explicit in every route; any prefix length 0โ€“32
CIDRClassless Inter-Domain Routing; introduced 1993
Class A1โ€“126, default /8, 16,777,214 hosts
Class B128โ€“191, default /16, 65,534 hosts
Class C192โ€“223, default /24, 254 hosts
Classful failure modeWaste or routing table explosion; no middle ground
Classless solutionVariable-length masking and prefix aggregation
AggregationCombining contiguous prefixes into one advertisement
Longest-prefix matchRouter selects the most specific matching route
Point-to-point prefix/30 (2 hosts) or /31 (2 hosts, RFC 3021)

Key takeaways:

  • Classful addressing embedded the mask in the address. The first octet determined whether the network was 8, 16, or 24 bits. No configuration was needed, and no flexibility was possible.
  • The waste was structural, not accidental. An organization needing 800 hosts had to choose between a Class B that wasted 64,000 addresses and multiple Class Cs that multiplied routing entries .
  • Classless addressing made the mask explicit. Every route carries its prefix length. The mask is advertised in routing protocols and configured on interfaces. Nothing is inferred.
  • Variable-length masking enables right-sizing. A /22 for 800 hosts, a /30 for a point-to-point link, a /29 for a small subnet. The prefix matches the requirement.
  • Aggregation requires contiguity. A service provider can advertise a single /16 for 256 customer /24s only if those /24s are contiguous and on bit boundaries .
  • Longest-prefix match is the routing rule. When multiple routes match a destination, the most specific (longest) prefix wins. This is the mechanism that makes classless routing work.
  • Linux routing is classless by design. Every ip route command uses an explicit prefix length. There is no classful mode. The LFCE engineer configures classless routing exclusively.

Remember: Classful addressing was a design that worked for a small internet and failed for a large one. It could not express the sizes that real organizations needed, and it could not aggregate the routes that real routers had to carry. Classless addressing fixed both problems by making the network length an explicit, variable property of every route. The prefix you configureโ€”/22, /30, /24โ€”is the direct descendant of that fix. When you add a route with ip route add 192.168.4.0/22 via 10.0.0.1, you are participating in the architecture that replaced classful addressing in 1993. The mask is not decoration. It is the entire point.


Was this helpful?


Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!