Traffic must flow through a virtual firewall instance in the middle of a VPC. How do you route it?
IntermediateScenarioAddressing, CIDR & Routing
Answer
Situation read → You need to steer traffic by route table to an instance ENI and let it forward packets that are not addressed to it.
What I'd do →
- Add a route in the app subnet route table: destination
10.0.2.0/24target the firewall ENI - Disable the source/destination check:
aws ec2 modify-instance-attribute --instance-id i-0abc --no-source-dest-check - Enable forwarding in the instance:
sysctl -w net.ipv4.ip_forward=1 - Add the matching return route so traffic is symmetric
Why → By default AWS drops packets whose source or destination is not the instance; routers and NAT boxes must opt out.
Interview tip → For production prefer Gateway Load Balancer, which scales and health-checks appliances, over a single ENI route.
More on Addressing, CIDR & Routing
You own 10.0.0.0/16 for a new VPC and need separate /24 subnets for dev, QA and prod across two AZs. How do you carve it up?BeginnerA host is configured as 192.168.1.130/25. What network does it belong to and what is the broadcast address?BeginnerHow many usable IPs does an AWS subnet of /28 have?BeginnerA route table has 10.0.0.0/16 -> local and 10.0.1.0/24 -> vpn-gw. Where does a packet to 10.0.1.5 go?BeginnerA newly built server can ping everything in its subnet but nothing outside. What is the first thing you check?BeginnerYou are picking a private range for a new company network. Which RFC 1918 range do you choose and why?Beginner