Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

A self-managed NAT instance is in place and routes point to it, but private instances still can't reach the internet.

IntermediateTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → Source/destination check is enabled on the NAT instance's ENI (AWS drops traffic not addressed to/from the instance itself), IP forwarding is off, or there's no MASQUERADE rule.

Diagnose →

aws ec2 describe-instance-attribute --instance-id <nat> --attribute sourceDestCheck
sysctl net.ipv4.ip_forward
sudo iptables -t nat -S POSTROUTING

Fix →

aws ec2 modify-instance-attribute --instance-id <nat> --no-source-dest-check
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/16 -j MASQUERADE

Persist both settings.

Prevent → Use managed NAT gateways unless cost forces otherwise; if you run NAT instances, bake them from a tested image with an ASG for recovery.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies