Search code examples
amazon-web-servicesipamazon-vpcsubnet

CIDR block for a subnet within VPC


When you create a subnet, you specify the CIDR block for the subnet, which is a subset of the VPC CIDR block.

But in the below diagram:

enter image description here

PublicSubnet1 is being assigned a network 10.10.32.0/20(which is not a subset of 10.10.0.0/16 network of VPC)


How does a packet with network id 10.10.32.0 enter into VPC with network id 10.10.0.0? Because as per my understanding, 10.10.0.0/19 is a subnet of 10.10.0.0/16 network but 10.10.32.0/20 is not a subnet of 10.10.0.0/16 network..correct me


Solution

  • I find CIDRs hard to calculate in my head. It's always advisable to use a CIDR calculator (eg https://cidr.xyz/).

    A CIDR of 10.10.0.0/16 goes from 10.10.0.0 to 10.10.255.254.

    A CIDR of 10.10.32.0/20 goes from 10.10.32.0 to 10.10.47.255. It IS a subset of 10.10.0.0/16.