CLOUD CONCEPT

Classless Inter-Domain Routing (CIDR)

Classless Inter-Domain Routing (CIDR) represents IP address ranges using an address and prefix length, enabling flexible subnet allocation and route aggregation without fixed address classes.

Cloud Concepts Hub →

What is Classless Inter-Domain Routing (CIDR)

CIDR defines how many leading bits identify an IP network and how many remain for addresses within that network. Engineers use it to size subnets, conserve address space, summarize routes, and prevent overlapping networks from disrupting cloud and hybrid connectivity.

Classless Inter-Domain Routing replaces fixed class-based network boundaries with variable-length prefixes. In IPv4, 10.20.0.0/16 identifies a network whose first 16 bits are fixed, leaving 16 bits for addresses. It contains 65,536 addresses. A /24 contains 256 addresses, while a /28 contains 16. A larger prefix number therefore means a smaller address range. IPv6 uses the same principle with 128-bit addresses rather than 32-bit addresses.

CIDR blocks must align with their prefix boundaries. For example, 10.20.4.0/23 covers 10.20.4.0 through 10.20.5.255. The adjacent /24 networks 10.20.4.0/24 and 10.20.5.0/24 can be summarized as that /23 because they are contiguous and correctly aligned. Arbitrary adjacent networks cannot always be combined into one exact prefix. Routers generally select the longest matching prefix, so a matching /24 route takes precedence over a matching /16 route. Aggregation reduces route counts, but an overly broad summary can attract traffic for networks that are not reachable through the advertising router.

In cloud networks, engineers allocate a parent address range to a virtual network and divide it into subnets. Plan ranges hierarchically across accounts, Regions, environments, and on-premises sites. For example, reserve 10.64.0.0/12 for a cloud estate and allocate distinct /16 blocks to individual VPCs. This creates room for growth and potential summarization, although cloud routing services do not necessarily generate summary routes automatically. A subnet's size should reflect workload density, availability-zone placement, scaling peaks, and infrastructure addresses rather than an arbitrary convention that every subnet must be a /24.

Address capacity is not the same as usable workload capacity. A standard AWS IPv4 subnet reserves its first four addresses and its last address, so a /24 normally provides 251 assignable addresses and a /28 provides 11. Network interfaces, interface endpoints, load balancers, and container networking can consume additional capacity. Monitor free addresses per subnet, not just unused space across the VPC. Free addresses in another Availability Zone do not help a deployment that must allocate interfaces in an exhausted subnet. Include headroom for rolling deployments, failover, and temporary scaling.

When an AWS VPC needs more IPv4 space, an additional, nonoverlapping secondary CIDR block can provide space for new subnets, subject to association rules and quotas. For example, a VPC using 10.20.0.0/16 might add 10.21.0.0/16 after checking the enterprise address plan and AWS restrictions. Existing subnet CIDRs cannot be resized: create larger or additional subnets and migrate or redeploy workloads. Update external routes, security rules, network ACLs, DNS dependencies, and connectivity advertisements as necessary. Adding a secondary block does not enlarge an existing subnet or automatically move resources into the new space.

Overlapping CIDRs create ambiguous destinations when networks are connected. Two independently isolated VPCs can both use 10.20.0.0/16, but direct routing cannot uniquely identify which instance of 10.20.1.10 is intended. AWS VPC peering rejects overlapping VPC CIDRs, and AWS Transit Gateway does not make overlapping address spaces transparently routable. Adding a nonoverlapping secondary block does not remove the original overlap; peering remains unavailable while any VPC CIDRs overlap. Durable solutions include renumbering and migrating workloads. Alternatives include translating selected traffic into unique ranges or exposing a specific service through AWS PrivateLink instead of providing general network connectivity.

Subnet optimization balances growth capacity against address conservation and operational complexity. Very small subnets can exhaust quickly, while oversized allocations can strand scarce private address space and complicate future interconnection. Centralized allocation and utilization tracking reduce accidental overlap across accounts and Regions. IPv6 can reduce dependence on scarce IPv4 addresses, but applications, connectivity paths, and security controls must support it. CIDR itself is neither encryption nor an access-control mechanism: a route establishes a forwarding choice, not permission to communicate.

Key aspects of Classless Inter-Domain Routing (CIDR)

CIDR enables flexible address sizing and route aggregation, while effective cloud use requires nonoverlapping allocation, subnet-level capacity planning, and controlled expansion.

Variable-length address prefixes

A prefix specifies the fixed network bits and determines the address range size. For IPv4, a /24 contains 256 addresses and a /26 contains 64; usable workload capacity depends on platform reservations.

Hierarchical allocation and aggregation

Allocate address space in aligned blocks that can accommodate future networks and support route summarization. Summaries must reflect actual reachability, and their creation or advertisement depends on the routing platform.

Longest-prefix route selection

Among matching destination routes, the more specific prefix generally wins. A /24 route can therefore steer a subset of traffic differently from a covering /16 route.

Overlap-aware connectivity design

Use unique ranges for networks that require direct routed connectivity, including cloud networks and on-premises sites. Where overlaps already exist, evaluate renumbering, controlled address translation, or service-level connectivity rather than assuming a transit router resolves the ambiguity.

Subnet capacity and growth planning

Size subnets for platform reservations, infrastructure interfaces, workload scaling, deployment surges, and failover. Track available addresses at the subnet and Availability Zone level to identify localized exhaustion.

Expansion without in-place subnet resizing

Additional virtual-network CIDRs can support new subnets but do not expand existing ones. In AWS, address exhaustion in an existing subnet usually requires workload migration or redeployment into another subnet, with associated routing and policy updates.

Cloud services for Classless Inter-Domain Routing (CIDR)

Amazon VPC implements CIDR-based virtual networks and subnets, while VPC IPAM coordinates allocations and monitors address use across accounts and Regions. Transit Gateway provides centralized routing between networks whose addressing and route tables support the required connectivity. When existing networks overlap, engineers can renumber workloads or use a carefully designed private NAT path for selected connections. PrivateLink offers a different approach by exposing specific services without requiring general routed connectivity. These services complement an address plan; none makes overlapping prefixes uniquely routable simply by connecting the networks.

Virtual private cloud VPC_32 image Amazon VPC

Amazon VPC uses CIDR blocks for VPC address space, subnets, route destinations, and address-based security rules. Secondary IPv4 CIDRs provide space for additional subnets, but existing subnet CIDRs cannot be resized and overlapping VPC CIDRs prevent peering.

Open Amazon VPC →
AWS Transit Gateway image AWS Transit Gateway

Transit Gateway connects multiple VPCs and other networks using route tables with CIDR destinations. Overlapping VPC ranges are not a general routed-connectivity solution; overlapping routes are not propagated for a newly attached overlapping VPC, so address planning or a separate remediation design remains necessary.

Open AWS Transit Gateway →
AWS PrivateLink image AWS PrivateLink

PrivateLink exposes supported services through private endpoints without requiring general routing between consumer and provider networks. It can provide service access between networks with overlapping CIDRs, but it does not merge their address spaces or enable arbitrary bidirectional connectivity.

Open AWS PrivateLink →