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)?

gefragt vor 2 Jahren880 Aufrufe
4 Antworten
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 pictureAWS
EXPERTE
kentrad
beantwortet vor 2 Jahren
  • 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
beantwortet vor 2 Jahren
AWS
EXPERTE
Hernito
überprüft vor 2 Jahren
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
beantwortet vor 2 Jahren
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.

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen