Home > Software engineering >  How to determine subnet IPv4 CIDR address in AWS
How to determine subnet IPv4 CIDR address in AWS

Time:01-16

How to determine subnet IPv4 CIDR address in AWS. Suppose my VPC CIDR block is 10.0.0.0/16 and I want to create a subnet with 172.31.1.0/16 but it says " *** is not within the range of ***/. Please explain me how to determine CIDR?

HOW TO SOLVE THIS MY PROBLEM I FACE PROBLEM AGAIN AND AGAIN

CodePudding user response:

Because your VPC is 10.0.0.0/16, everything in the VPC must be inside this range, therefore it must be 10.0.something.something and cannot be 172.31.something.something.

You can normally add multiple CIDR blocks to a VPC, but according to this table you cannot add CIDR blocks from more than one different RFC 1918 range (the standard 10.x.x.x, 192.168.x.x or 172.16-31.x.x ranges).

You may create your subnet as a subnet of 10.0.0.0/16 (e.g. 10.0.123.0/8 - they don't have to be /8, that's just to make a convenient example) or you may add more CIDR blocks starting with 10. and put your new subnet in one of those blocks.

CodePudding user response:

A CIDR of 10.0.0.0/16 means "any IPv4 IP address that starts with 10.0.x.x".

Your subnet CIDR of 172.31.1.0/16 is not inside the range of 10.0.0.0/16. Therefore, it is rejected.

You would need to use a subnet range such as 10.0.0.0/24, which would refer to all IP addresses starting with 10.0.0.x.

I highly recommend using a CIDR calculator to determine IP address ranges and CIDR notation.

  • Related