Reputation: 1192
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:
Upvotes: 2
Views: 5960
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:
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
:
Upvotes: 2