Subnetting & CIDR
Why subnetting exists
- Isolation: reduce broadcast domains, segment environments (prod/dev), security boundaries.
- Scalability: organize address space and route aggregation.
- Efficiency: allocate addresses sized to needs instead of wasting large blocks.
Network vs host bits
- In
a.b.c.d/N, the first N bits identify the network; remaining bits identify the host.
- Hosts share a subnet if their network bits match under the mask.
Subnet masks explained
- A subnet mask is the IPv4 way to represent CIDR, e.g.:
/24 → 255.255.255.0
/16 → 255.255.0.0
- Mask bits set to 1 indicate the network portion.
VPC subnet design in cloud
- Start with a VPC CIDR (e.g.,
10.0.0.0/16) and carve subnets per AZ/purpose.
- Typical split: public subnets (route to Internet Gateway) vs private subnets (no direct inbound Internet).
- Leave room for growth; avoid overlaps with on‑prem if you plan VPN/Direct Connect/peering.
Practical subnet calculations
- IPv4 address count in a
/N block: (2^{(32-N)}).
- Example:
/26 → (2^{6}=64) addresses (usable may be fewer depending on platform reservations).
- Sanity check by writing the block boundaries (increments) in the relevant octet.