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
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.
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.
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?
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.
- Accepted Answerasked 20 hours ago
- asked 4 years ago
- Routing network traffic between two EC2 instances in the same subnet to a firewall appliance in another VPCAccepted Answerasked a year ago
- How do I troubleshoot the connection between Transit Gateway and third-party virtual appliances running in a VPC?AWS OFFICIALUpdated 8 months ago
- How do I troubleshoot issues with hosted zones in Route 53 that have the same domain names in different AWS accounts?AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- EXPERTpublished 8 months ago
Is the /16 you are trying to route not the VPC's CIDR address(es)?