0

I have my VPC configured with 10.0.0.0/16 CIDR. I want to create around 7-10 subnets in this VPC.

On my calculation, I have decided to have 8 subnets where each subnet can host 8192 resources (8192*8=65536).

As per my calculation, 2^13=8192. Subtracting it from the max size of 32 (32-13)= 19. So is it 10.0.0.0/19? If that is so, this would be the CIDR for first subnet. What would be for the rest 7?

I have tried with 10.0.0.0/19. Next when I go with 10.0.1.0/19, it is throwing an error.

But I am in confused state as in how can I allocate ipv4 CIDR to 8 subnets? What would be starting and ending range? How can I calculate what IPV4 CIDR can I allocate to each subnet?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

2 Answers2

0

Tip: Always use a CIDR calculator when determining CIDR ranges. Unassisted, it is too hard for the human brain!

The subnets for /19 ranges would be:

  • 10.0.0.0/19
  • 10.0.32.0/19
  • 10.0.64.0/19
  • 10.0.96.0/19
  • 10.0.128.0/19
  • 10.0.160.0/19
  • 10.0.192.0/19
  • 10.0.224.0/19

Each of these ranges contain 8192 IP addresses. The portion before the slash identifies the first IP address in the range.

You were receiving an error because 10.0.1.0 is within the 10.0.0.0/19 range, and does not start that range.

Many people like using /24 because it simply changes the second-last number, eg: 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24. However, each of these ranges only contain 256 IP addresses.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Can you let me know how did you choose 0,32,64 etc? Is there any calculation? – vivek reddy Apr 23 '20 at 06:01
  • Go to a CIDR calculator, enter `10.0.0.0/19`. It will tell you that it goes from `10.0.0.0` to `10.0.31.255`. Therefore, the next range starts with `10.0.32.0`. It matches your calculations because `32*256=8192`, so each `/19` range would increment by `32` in the third dotted number. – John Rotenstein Apr 23 '20 at 08:23
0

I ran into similar problem in the past, so I built a tool to automate the calculation. You can check it out at: https://houqp.github.io/vpcstudio/.

If you provide it with 10.0.0.0/16 as the CIDR and layout the number of subnets you want in the yaml, it should automatically generate the optimal CIDR range for each subnet for you.

houqp
  • 761
  • 1
  • 8
  • 12