Networking

Handling IP Address Overlapping in Network Connections

IP address overlapping happens when two or more networks use CIDR ranges that share one or more addresses. When you try to connect them…

Handling IP Address Overlapping in Network Connections
Share:

Handling IP Address Overlapping in Network Connections

5 min read
1.5K views

IP address overlapping happens when two or more networks use CIDR ranges that share one or more addresses. When you try to connect them through VPC peering, VPN, or Direct Connect, routing can break because the network can’t tell which destination you mean. This is a common problem in AWS when connecting VPCs across accounts, regions, or to on-premises networks.

This post covers why overlapping happens, why some AWS services won’t work around it, and six practical options.

Advertisement

What Does Overlapping Look Like?

Say you have two VPCs that need to communicate:

Network CIDR IP Range
VPC-A (Account A) 10.0.0.0/16 10.0.0.0 – 10.0.255.255
VPC-B (Account B) 10.0.0.0/16 10.0.0.0 – 10.0.255.255

Both VPCs use 10.0.0.0/16. If an EC2 instance in VPC-A sends a packet to 10.0.1.50, the router has no way to know whether that address is in VPC-A or VPC-B. The packet stays local.

This also applies to partial overlaps. If VPC-A uses 10.0.0.0/16 and VPC-B uses 10.0.0.0/24, VPC-B’s range falls entirely inside VPC-A’s range, so VPC peering still won’t work.

Advertisement

Why VPC Peering Won’t Help

AWS VPC Peering explicitly blocks connections between VPCs with overlapping CIDRs. You’ll get an error if you try to create a peering connection between them. This is by design. The route tables can’t distinguish between local and remote traffic when the ranges overlap.

With ordinary VPC route propagation, Transit Gateway does not propagate the overlapping CIDR of a later VPC attachment. Route selection uses the longest matching prefix, so a matching /24 takes precedence over a /16. Equal destination prefixes still cannot identify which copy of an overlapping address you intended. Use a distinct translated destination or a service endpoint.

Solution 1: Re-address One Network

The cleanest fix is to change the CIDR of one of the overlapping networks. This eliminates the problem at the source.

When this works: The conflicting VPC is small, new, or has few resources. If you’re early in a project, re-addressing is worth the short-term effort to avoid long-term workarounds.

When it doesn’t: The VPC hosts production workloads with hardcoded IPs, security group references, or DNS records. Changing the CIDR means rebuilding subnets and migrating resources, which can mean downtime.

AWS lets you add a secondary CIDR to an existing VPC without rebuilding it. You can create new subnets in the secondary range, migrate resources over time, and eventually stop using the conflicting subnets. An overlapping primary CIDR remains associated, so VPC peering still requires a replacement VPC with a non-overlapping primary CIDR. To plan new, non-overlapping ranges, try the AWS VPC Subnet Planner.

Solution 2: Private NAT Gateway

A private NAT gateway translates the source of a connection that a client initiates. For example, place it in a unique subnet in VPC-A and expose the destination service through an internal Application Load Balancer in a unique subnet in VPC-B. Route between the unique ranges through Transit Gateway and configure the return routes. The load balancer forwards requests to its targets in VPC-B, even if their addresses overlap VPC-A.

Replies to connections initiated by VPC-A can traverse the same private NAT gateway. Unsolicited connections cannot. If VPC-B must initiate its own connections, design a separate path. See the AWS private NAT example for route placement.

The RFC 6598 shared range is 100.64.0.0/10. You can use an eligible block such as 100.64.0.0/16 as a VPC secondary CIDR, subject to AWS association rules. The range is intended for shared use outside the public Internet. Check for conflicts with your VPN, carrier, and connected networks before allocating it.

PrivateLink is the modern AWS approach to cross-VPC connectivity when CIDRs overlap. It works because it creates a private endpoint in your VPC that gets its own IP from your subnet. It doesn’t need to route to the remote VPC’s CIDR at all.

How it works:

  1. VPC-B exposes a service behind a Network Load Balancer
  2. VPC-B creates a VPC Endpoint Service pointing to that NLB
  3. VPC-A creates an Interface VPC Endpoint that connects to VPC-B’s endpoint service
  4. VPC-A gets an ENI with a local IP in its own subnet

When to use: You need service-to-service connectivity (e.g., API calls) rather than full network-level access. PrivateLink can work across AWS accounts and supported Regions. For cross-Region access, the provider must enable the consumer Region.

Limitation: Traffic is initiated by the consumer. VPC-A, the consumer, initiates connections to the provider (VPC-B). If both sides need to initiate, you’d set up endpoint services in both VPCs.

Solution 4: Transit Gateway 1:1 NAT

For network-level connectivity, check whether Transit Gateway 1:1 NAT supports your attachments and Region. Assign each overlapping VPC a distinct NAT CIDR. For example, map VPC-A’s 10.0.0.0/16 to 10.1.0.0/16 and VPC-B’s identical range to 10.2.0.0/16. Clients connect to the other VPC using its translated addresses. Both sides need unique NAT ranges and routes that point to the transit gateway.

Adding a third VPC and two peering connections does not create a transit path. VPC peering is non-transitive.

Solution 5: Amazon VPC Lattice

Use Amazon VPC Lattice when multiple VPCs need to reach a set of services despite overlapping CIDRs. Publish the services to a service network and associate client VPCs or connect them through service network endpoints. Configure allowed clients and service authorization. Clients access the service endpoints through Lattice without routing directly to the overlapping VPC addresses.

Solution 6: Plan Ahead with IPAM

The best solution is preventing overlaps in the first place. AWS VPC IPAM (IP Address Manager) lets you allocate and track CIDR ranges centrally across your entire AWS organization.

With IPAM, you define IP pools and assign ranges from those pools when creating VPCs. This prevents two teams from accidentally picking the same CIDR. IPAM is especially useful in multi-account setups managed with AWS Organizations.

For a guide on planning VPC CIDRs from scratch, see How to Design IP Addressing for Amazon VPC and Subnets.

Which Solution Should You Use?

Solution Best For Complexity
Re-address Small or new VPCs with few resources Low (if early), High (if production)
Private NAT gateway Client-initiated connections to reachable service addresses Medium
PrivateLink Service-to-service API calls Low
Transit Gateway 1:1 NAT Network access through unique translated ranges High
VPC Lattice Shared service access across multiple VPCs Medium
IPAM (prevention) Multi-account organizations Low (upfront planning)

Conclusion

For service access, start with PrivateLink or VPC Lattice. If clients need to reach network addresses directly, evaluate Transit Gateway 1:1 NAT or move the workloads to non-overlapping ranges. Use IPAM to avoid new conflicts.

For cross-account work beyond networking, see How to Set Up Cross-Account Access in AWS with AssumeRole.

Recommended for Linux builders

Contabo VPS hosting for Linux projects

Run Linux servers, automation tools, and self-hosted apps on a Contabo VPS with generous resources and predictable pricing.

Our customers sayExcellent4.6 out of 5 based on 11,008 reviews Trustpilot

Some links are affiliate links. This may earn LinuxBeast a commission at no extra cost to you.

Privacy settings

Choose which privacy controls to open.

Opening these controls does not change your saved choices.