Addresses and Prefixes
An IPv4 address is thirty two bits, written as four octets. Each address splits into a network prefix and a host part. The boundary is set by the subnet mask.
CIDR Notation
CIDR notation writes the prefix length after a slash. A slash twenty four means the first twenty four bits identify the network, leaving eight bits for hosts.
- A slash twenty four offers two hundred fifty six addresses, of which two hundred fifty four are usable.
- The network address is the lowest address and identifies the subnet.
- The broadcast address is the highest address and cannot be assigned to a host.
Subnetting
Subnetting borrows host bits to create smaller networks. Moving from a slash twenty four to a slash twenty six creates four subnets of sixty four addresses each. Each step of one bit halves the host count and doubles the number of subnets.
Why It Matters
- Subnets contain broadcast traffic and let routers aggregate routes.
- Right sizing avoids wasting scarce address space.
- Private ranges such as the ten range and the one hundred ninety two dot one hundred sixty eight range are reused behind network address translation.
Reading a prefix length quickly tells you the network size and how many hosts it holds.
Key idea
CIDR prefix length splits an address into network and host bits, and borrowing host bits subnets a block into smaller, route aggregatable networks.