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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ