Subnetting via Boolean Algebra
Subnetting relies on the bitwise Logical AND operation. When a host wants to determine if another host is on its local subnet, it performs a bitwise AND between its own IP address and its subnet mask.
The AND Rule:
- `1 AND 1 = 1`
- `1 AND 0 = 0`
- `0 AND 1 = 0`
- `0 AND 0 = 0`
Mathematical Proof of Subnet Counts
If you borrow `b` bits from the host portion of an IP address to create subnets:
\[ \text{Created Subnets} = 2^b \]
\[ \text{Hosts per Subnet} = 2^{(h - b)} - 2 \]
where `h` is the original number of host bits. For example, dividing a `/24` network into `/26` subnets borrows `b = 2` bits, creating `2^2 = 4` subnets, each containing `2^{(8-2)} - 2 = 62` usable hosts.
