Skip to content

Dividing your VPC into two unevenly size subnets

0

I have been allocated an CIDR range of 10.10.192.0/21 for my VPC , I wish to divide this into two subnets one which as 32 IP address and the other with 2016 (basically the rest). when I try to do something like 10.10.192.0/27 and 10.10.192.32/21

I get an error for the second one saying

must be a valid IPv4 CIDR

how do I accomplish the same?

asked 2 years ago517 views

2 Answers
1

Hello.

If the VPC CIDR is "10.10.192.0/21", you cannot set "10.10.192.32/21" in the subnet.
Also, since subnet division is calculated by increasing the number to the power of 2, it is not possible to create a subnet with 2016 IP addresses. (This is not AWS knowledge but basic network knowledge) (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048...)

https://interlir.com/2024/02/19/easy-ipv4-subnetting-and-mask-calculation-method/

Calculate the subnet size: Use the formula 2^n (where n is the number of host bits) to find how many addresses are in each subnet.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Thanks for clarifying, so does this mean that I can have 7 subnets (instead of 2).

    1. /27
    2. /27
    3. /26
    4. /25
    5. /24
    6. /23
    7. /22
  • Since your VPC is created with "/21", you can create two subnets with "/22", or create multiple subnets with "/28", etc. This combination depends on the network design, so how many remaining ones you can create is up to you.

0

Your subnet CIDR must be a subset of your VPC CIDR. If you are looking to divide into 2, you can have 10.10.192.0/27, which has 32-5 = 27 useable IP (1 network address, 1 broadcast address, and 3 reserved by AWS).

For your second subnet, the biggest you can have is 10.10.196.0/22.

Then you have 10.10.192.33-10.10.195.255 available that you can assign to other subnets.

Basically you are splitting the /21 VPC into 2 /22 networks, and then further splitting /22 into smaller CIDRs, one of which is /27.

AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.