CIDR notation is a format for IP address and a suffix is attached to indicate Network identifier bits. For example, consider an IP address, 10.0.0.0/16
For this IP, /16 represents the Network bits,
So the first two blocks reserved for network that means these two blocks won’t change at all.
The following IP will be start from, 10.0.0.0
The IP will be end at, 10.0.255.255
So how many IP can be create from 10.0.0.0 to 10.0.255.255? There is a formula, 2 ^ (total number of bits – total number of bits allocated for network)
With this formula, 2 ^ (32 -16) = 65536, so 65536 can be created with the range of 10.0.0.0-10.0.255.255
This is the overview for CIDR notation.
Now let’s move to subnetting. What is Subnetting?
For a given IP or CIDR notation we can get one or more IP addresses by splitting the CIDR notation (10.0.0.0/16), this process is called Subnetting.
We split two subnets one is 10.0.0.0/24 and another one is 10.0.1.0/24 (these two subnets can’t be same). The network of 10.0.0.0/16 cannot be greater than its subnet’s network.
For subnet 1 the total number of ip will be, 2 ^ (32-24) = 256, so the range will be 10.0.0.0 – 10.0.0.255
For subnet 2 the total number of ip will be, 2 ^ (32-24) = 256, so the range will be 10.0.1.0 – 10.0.1.255
Now let’s use these IP addresses inside AWS VPC,
VPC stands for Virtual Private Cloud which lets you launch AWS resources in a logically isolated virtual network. VPC itself has an IP address attached lets say 10.0.0.0/16
Inside of that VPC there can be multiple Availability Zone and each availability zone has an IP address attached which is called subnet. Lets look at the diagram,
Two Availability Zone have their (two) Subnet. This is the overview of CIDR notation and Subnetting in AWS VPC.