Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple AWS routes with same Destination Cidr Blocks

I'm trying to create two routes for two nat gateways that live in separate subnets. Is there a reason why they can't have a destination cidr block of 0.0.0.0/0?

like image 864
masterforker Avatar asked Feb 21 '17 03:02

masterforker


People also ask

Can two VPC have same CIDR block?

Two VPCs with multiple CIDRs peered togetherYou can add IPv4 CIDR blocks to your VPC. In this example, VPC A and VPC B have multiple IPv4 CIDR blocks. The route tables for each VPC point to the VPC peering connection to access all the IPv4 CIDR blocks of the peer VPC.

Can you peer two private networks with the same CIDR range?

You cannot have multiple subnets with the same (or overlapping) CIDR blocks in the same VPC, though, because AWS treats it as one continuous network.

Can AWS subnet have multiple route tables?

Within a VPC, route tables are assigned to individual subnets. With only 1 route table created in a VPC, all of the subnets would be assigned to that route table. You can create multiple route tables in a VPC, or you can leave the 1 default route table.

What is an overlapping CIDR block?

VPC A and VPC M have overlapping CIDR blocks. This means that peering traffic between VPC A and VPC C is limited to a specific subnet (subnet A) in VPC C. This is to ensure that if VPC C receives a request from VPC A or VPC M, it sends the response traffic to the correct VPC.


1 Answers

I presume that you are wanting to create a Highly Available network that is using multiple NAT Gateways in separate Availability Zones.

This is a common design requirement. Amazon EC2 instances in a private subnet that wish to communicate with the Internet require a route to a NAT Gateway (or a NAT Server). To remain highly available, you will need a NAT Gateway in each Availability Zone and a different route table for each Availability Zone.

Highly Available VPC with multiple NAT Gateways

Then:

  • The Route Table for the private subnet in Availability Zone A would have a 0.0.0.0/0 route that points to NAT Gateway A.
  • The Route Table for the private subnet in Availability Zone B would have a 0.0.0.0/0 route that points to NAT Gateway B.

Each route table can only have one entry for a given CIDR range. The VPC selects the most-restrictive CIDR range that matches, so the 0.0.0.0/0 entry will be the last one referenced.

like image 166
John Rotenstein Avatar answered Oct 03 '22 01:10

John Rotenstein