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

질문됨 2년 전956회 조회
4개 답변
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
전문가
kentrad
답변함 2년 전
  • 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
답변함 2년 전
AWS
전문가
Hernito
검토됨 2년 전
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
답변함 2년 전
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.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠