Understanding CIDR (Classless Inter-Domain Routing)

Classless Inter-Domain Routing, or CIDR, expresses an IP network as an address followed by a prefix length, such as 10.24.0.0/16. The prefix specifies how many leading address bits identify the network. It is not a speed setting, a security policy, or a guarantee that an address range is reachable from another network. CIDR underpins subnet allocation, route selection, aggregation and cloud VPC design. Understanding its arithmetic lets an engineer decide whether a range is large enough, whether two networks overlap, and whether a route will send traffic toward the correct destination.

The original AWS networking topic becomes much easier when separated into three decisions: how addresses are allocated, how routes match those addresses, and how access controls govern the resulting packets. A private address can be assigned correctly yet remain unreachable because the routing or security configuration is wrong. Conversely, adding a broad route does not create additional available addresses. This guide moves from the binary meaning of CIDR to concrete AWS subnet examples, then to IPv6 and hybrid networks where mistakes can be difficult to reverse.

Read the Address and Prefix Together

IPv4 addresses have 32 bits. An IPv4 prefix /24 says that the first 24 bits are the network portion, leaving eight bits for the host portion. A block therefore spans 2^(32-24), or 256 addresses. For example, 192.0.2.0/24 includes addresses from 192.0.2.0 through 192.0.2.255. That prefix has the dotted decimal mask 255.255.255.0. These example addresses belong to documentation ranges rather than a production deployment. The range size comes from the bit calculation, not from an arbitrary naming convention.

A /26 leaves six host bits and spans 64 addresses. Dividing 10.24.8.0/24 into /26 networks yields four ranges: 10.24.8.0–63, 10.24.8.64–127, 10.24.8.128–191, and 10.24.8.192–255. Each boundary must align with a multiple of 64 in the final octet. An arbitrary 10.24.8.70/26 host falls within the second range, whose network address is 10.24.8.64. Write the network boundary in designs and route tables, not an arbitrary endpoint address, unless a tool explicitly normalizes it.

A smaller prefix number represents a larger IPv4 address block: /16 contains more addresses than /24, and /24 contains more than /28. CIDR does not use the historical class A, B and C defaults to decide the range. The original invention of classless routing allowed networks to allocate and advertise address prefixes that better fit actual requirements. IPv4 subnetting therefore requires interpreting the numerical prefix rather than assuming every address beginning with 10 must be treated as a /8 in every context.

Understand What the AWS Subnet Can Actually Assign

An AWS VPC contains one or more IPv4 CIDR blocks and may also have IPv6 blocks. Each subnet belongs to one Availability Zone and receives an address range inside its VPC allocation. Subnet ranges must not overlap with each other in the same VPC. An IPv4 subnet may be no smaller than /28 and no larger than /16 under AWS VPC subnet rules. A /28 spans 16 total addresses, but AWS reserves the first four and last address in each subnet, leaving 11 assignable addresses for typical IPv4 subnet resources.

Those five reservations are an AWS VPC-specific rule, not the universal formula for all networks. A generic /28 on a traditional LAN has 16 mathematical addresses, while cloud providers impose their own reservations and service constraints. The first and last IPv4 address in an AWS subnet cannot be assigned to instances, and addresses immediately after the network address have platform purposes. Planning a subnet as though it has all 16 addresses available can lead to launch failures when capacity is needed most.

Subnet sizing should anticipate not only present EC2 instances but also load balancers, elastic network interfaces, autoscaling events and managed services that allocate private IPs. A /28 might be technically valid yet operationally unsuitable for a group that regularly scales and replaces nodes. Reserve address capacity for upgrades and recovery, not just steady-state utilization. Check service-specific subnet requirements because some managed products require additional spare addresses or subnets in more than one Availability Zone.

Separate Routing From Assignment and Authorization

A route table associates a destination CIDR with a target, such as local VPC routing, a virtual private gateway, a transit gateway, an internet gateway or a NAT gateway. Routers select a matching route according to routing rules, commonly preferring the longest matching prefix. If traffic to 10.24.8.20 matches both 10.24.0.0/16 and 10.24.8.0/24, the /24 is more specific. This rule is central to troubleshooting surprising routes and designing safe network segmentation.

A default IPv4 route 0.0.0.0/0 matches all IPv4 destinations that are not covered by a more specific route. Its target determines whether traffic can leave the VPC or reach a shared egress layer. It is not automatically an internet connection. Internet gateway routing, resource public-address assignment and instance-level firewall controls are separate requirements for an internet-accessible service. The AWS networking skills needed to operate a VPC include interpreting the full route path rather than treating the presence of a default route as proof that access works.

Security groups and network ACLs evaluate traffic according to their own rules. A route can be correct while a stateful security group denies the intended application flow; allowing traffic in a security group does not fix a missing route. For a diagnosis, identify the source and destination addresses, direction, protocol, ports, associated route tables and security policies. Verify DNS separately if the application accesses a hostname. CIDR tells you which address ranges are in scope; it does not independently authorize access.

Avoid Address Overlap in Hybrid Architectures

Two independent networks can both use 10.0.0.0/16 while functioning locally. Problems emerge when they must communicate through a VPN, Direct Connect, transit gateway or merger integration: a packet for 10.0.8.10 may be ambiguous if both sides claim that destination. Renumbering production networks can be expensive because static addresses, database allowlists, DNS, firewall rules and application configuration may depend on them. Create an enterprise address allocation map before choosing VPC blocks, and review plans with network owners outside the cloud team.

Choose VPC and subnet ranges with room for future accounts, environments and Regions. Consider allocating a distinct high-level private block to each region or business unit, then subdividing in consistent sizes. A design can use summarizable ranges without forcing every small network into one enormous flat trust domain. Aggregation reduces routing-table complexity, but broad aggregate routes must not accidentally capture destinations that should reach a different gateway. This trade-off becomes particularly important in shared-service and hub-and-spoke networks.

Address translation can sometimes permit connectivity when overlapping ranges cannot be renumbered immediately, but translation adds state, troubleshooting work and limitations. A NAT gateway may translate outbound addresses for a defined path; it cannot resolve every overlapping address problem on its own. Review NAT gateways and VPC interconnection in the context of the actual route, ownership and security model rather than using NAT as an automatic remedy for poor IPAM planning.

Summarize Routes Without Advertising Unused Space

Two adjacent /25 networks, 10.24.8.0/25 and 10.24.8.128/25, can be represented by the /24 prefix 10.24.8.0/24 when the aggregate accurately describes the reachable destinations. The ranges must be contiguous, aligned and controlled by the same routing policy. Summarization can reduce routing updates and make topology easier to reason about; incorrectly aggregating unrelated ranges can create black holes or send sensitive traffic to an unintended path.

CIDR allocation plans are not immutable. As demand changes, teams may add secondary VPC CIDR blocks, create new subnets or migrate services to new ranges. Each change requires checking the provider’s permitted associations, overlapping destinations and peering or transit gateway limitations. An apparent free block in a spreadsheet may already be advertised by a data-center network or reserved for disaster recovery. Maintain a single approved inventory with the purpose, region, owner, allocation date and next review date of each prefix.

IPv6 Prefixes Require a Different Mental Model

An IPv6 address has 128 bits, so /64 identifies a vastly larger address block than any IPv4 subnet. Counting individual usable addresses is rarely the practical constraint in an IPv6 VPC. Instead, the design considers which prefixes belong to VPCs and subnets, routing policies, address assignment and operational visibility. Do not copy an IPv4 assumption that every network needs a tiny number of host bits. IPv6 subnet sizing and supported allocation units follow the AWS service’s rules rather than a 32-bit analogy.

A dual-stack subnet has both IPv4 and IPv6 blocks; an IPv6-only subnet has different egress and service compatibility constraints. An IPv6 default route uses ::/0, not 0.0.0.0/0. Egress-only internet gateways can support outbound-initiated IPv6 connectivity, while DNS64/NAT64 can help IPv6-only resources access IPv4-only endpoints in supported configurations. Route preference, security policies and application support still need testing. The notation changes, but the design discipline—explicit prefixes, ownership and verified reachability—does not.

Validate the Calculations and the Real Network

A sound design review includes at least one calculation by hand and one verification with a trusted IP calculator or infrastructure command. For the example 10.24.8.64/26, confirm the network boundary, final address and size of 64 before allocating it. Then verify that the AWS subnet is associated with the intended VPC, Availability Zone and route table. An arithmetic answer is necessary but not sufficient; it does not reveal a conflicting transit advertisement or a service requiring spare addresses.

For a lab, create a small address plan on paper first: one /16 VPC, several nonoverlapping /24 subnets in different Availability Zones, private and public route-table associations and an anticipated workload growth rate. Use infrastructure code or read-only network inspection tools to compare the deployed topology against the plan. Test connectivity and denial conditions separately. Label every diagram with the actual CIDR prefix, not a vague phrase such as “the private network,” so route decisions can be reproduced later.

When troubleshooting, compute the destination’s matching subnet and inspect route selection before changing security policy. A traceroute or reachability tool may narrow the failure, but firewalls and network appliances can affect visibility. Record the observed path and the expected path. Avoid fixing uncertainty by adding ever broader allow rules or default routes. The goal is to prove which element controls the packet and to make the smallest safe correction.

CIDR is a compact language for allocating and routing addresses. Its power comes from clear prefix mathematics, carefully aligned boundaries, nonoverlapping allocations and matching that favors the most specific route. AWS adds platform subnet limits and reserved addresses that should be counted explicitly. When engineers combine accurate arithmetic with an enterprise address inventory, route analysis and deliberate authorization, a subnet plan becomes a reliable foundation for hybrid and cloud operations rather than a source of recurring outages.