2.6. IPv4 Addressing and Subnetting
đź’ˇ First Principle: An IP address is divided into two parts: the network portion (which network does this belong to?) and the host portion (which device within that network?). The subnet mask tells devices where that division occurs. Subnetting is about borrowing bits from the host portion to create more networks with fewer hosts each.
Consider this scenario: You're assigned 10.0.0.0/8 for your entire company. Without subnetting, all 16 million addresses are in one broadcast domain—every device hears every broadcast from every other device. Network performance collapses. With subnetting, you carve that /8 into hundreds of smaller networks: /24 for each floor, /30 for point-to-point links. Each subnet is a contained broadcast domain.
What happens when you get subnetting wrong: You assign two devices to the same IP (duplicate address). You configure a default gateway that's not on the same subnet (unreachable). You create overlapping subnets (routing chaos). Subnetting errors cause mysterious connectivity problems that are hard to debug—getting it right the first time is critical.
The key insight: Every time you borrow one bit from hosts, you double your networks but halve your hosts. That's the fundamental trade-off of all subnetting decisions.