Search code examples
amazon-web-servicesamazon-vpcipv4subnetvpc

Calculating the IPv4 CIDR blocks for subnets in AWS


I'm just beginning with AWS and started looking and trying out how VPC, Subnets, RT and other networking stuff works. Unfortunately my networking knowledge is limited so I'm encountering issues.

Having assigned the following IPv4 CIDR block 192.168.0.0/24 to a VPC. What I want to know is if I can create 3 subnets, and if so I'm looking for the actual calculus and formulas for the 3 subnets IPv4 CIDR blocks


Solution

  • if I can create 3 subnets

    Yes.

    I'm looking for the actual calculus and formulas for the 3 subnets IPv4 CIDR blocks

    There are no specific formulas.
    AWS says "When you create a subnet, you specify the CIDR block for the subnet, which is a subset of the VPC CIDR block"

    0/24 covers 256 IPs. You can calculate this number by 2 ^ (32 - 24).
    The first 4 IPs and the last IP in subnet CIDR are reserved by AWS and you cannot use them.