Interview Prep/Networking/Addressing, CIDR & Routing

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

BeginnerScenarioAddressing, CIDR & Routing
Answer

Situation read → Two routes match the destination and the router must pick one.

What I'd do →

  1. Apply longest prefix match: /24 is more specific than /16
  2. Packet goes to the VPN gateway, not local
  3. AWS now accepts routes more specific than the local route (for example to steer a subnet range to a firewall ENI), so check aws ec2 describe-route-tables for what is really configured
  4. On Linux test with ip route get 10.0.1.5

Why → Routers always prefer the most specific matching prefix before looking at metrics or administrative distance.

Interview tip → Say you read the effective route table rather than assuming, because more-specific-than-local routes are legal in AWS today.

All Networking questions Roadmap: Networking for DevOps

More on Addressing, CIDR & Routing