Forward the traffic between two instance

0

Hi Team,

I have a VPC with two private subnets in different Availability Zones, one in eu-west-a and the other in eu-west-c. I would like to know how to create a route to forward the traffic of a / 16 network from an EC2 instance that is in the eu-west-a subnet to another instance in the eu-west-c subnet. I have tried to create a static route using ip route but it tells me: nexthop has invalid gateway, logical being in different networks, I have also tried using the aws panel, add a new route in the routing table but I don't see this route in EC2 instances that inherit this configuration, and packets do not appear to reach the eu-west-c subnet instance.

Regards, Javi

  • Is the /16 you are trying to route not the VPC's CIDR address(es)?

asked a year ago55 views
4 Answers
2

You can do this by adding a route to your route table associated with the subnet. Something like this:

aws ec2 create-route --route-table-id rtb-22574640 \
    --destination-cidr-block 192.168.2.0/24 \ 
    --network-interface-id eni-c0a643a9
profile picture
AWS
EXPERT
kentrad
answered a year ago
  • Note that if you have source packets coming from a network not in your VPC, you will need to turn src/dest validation off for that instance which is forwarding the packets.

1

Got it, thanks for clarifying. The CIDR of the route needs to be the entire CIDR of a subnet within the VPC. You'll need to ensure that the middlebox appliance (said EC2 instance) needs to be in a dedicated subnet of its own.

This blog provides a detailed walkthrough of how to insert a middlebox appliance between two subnets.

AWS
AC
answered a year ago
AWS
EXPERT
Hernito
reviewed a year ago
0

By default, you'll have a 'local' route within the VPC that allows connectivity within the VPC. Can you confirm that you have the local route in your subnet route tables? Did you create any Security Groups or Network Access Control Lists to block communication?

AWS
AC
answered a year ago
0

Our instances see each other, but we want to send specific traffic from one instance to the other. For example: the packets that will have the IP 192.168.2.0/24 as their destination will be forwarded to the other instance.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions