indichimp
indichimp

Reputation: 1192

AWS VPC Route Table -- Delete default route

In AWS VPC each route table you create comes with a defualt (local route 10.0.0.0/16) this causes some problem when I want my EC2 instances to have another EC2 instance as default gateway.

For instance if you have two EC2 intances namely A (in subnet 10.0.30.0/24) and B (in subnet 10.0.40.0/24) and if you set A as the default gateway for B then all packets from B are not sent via A. Instead they are sent via 10.0.40.1.

I even tried creating a new route table and add a route like : 0.0.0.0/0 go via NIC of A, even this does not route traffic via A

If I delete the route to 10.0.40.1 on B then I lose all connectivity to B

My questions are:

  1. What can I do to make sure all packets from B are always sent via A?
  2. Is it possible to delete the 10.0.0.0/16 local route?
  3. What else can I do to do what I want?

Upvotes: 2

Views: 5960

Answers (1)

Rico
Rico

Reputation: 61641

Well. In this case, A also needs to have an interface in 10.0.40.0/24 if you want to forward packets through it. A and B are in different segments which makes it impossible for one to reach the other at the IP level (Packets are going through a router that you don't control by default).

In essence what this diagram shows:

VPC Description

I believe you can create this connection with creating a Network Interface in your VPC subnet 10.0.40.0/24 and then attaching it to the Instance in A:

Network Interfaces

Upvotes: 2

Related Questions