skip to Main Content

I am trying to create a subnet within a default VPC.
The IPv4 CIDR block I am using is 172.31.56.0/22 but it keeps saying it overlaps with existing subnet CIDR block: 172.31.48.0/20.
what am I doing wrong?

I’ve tried /24 also and still the same error.

2

Answers


  1. Let’s have look at below image to understand how CIDR works.

    enter image description here

    Your existing subnet CIDR is 172.31.48.0/20, which means it holds 2 to the Power of 12 IP addresses, that is equal to 4096.

    Here is the range of your existing subnet. Screenshot captured from https://www.ipaddressguide.com/cidr website.

    enter image description here

    So, now if you want to create a new subnet with 256 IP addresses, then you can create it either before 172.31.48.0 or after 172.31.63.255 IP addresses.

    For example, below CIDR examples will work for you.

    • 172.30.0.0/24 (Range is from 172.30.0.0 to 172.30.0.255)
    • 172.30.1.0/24 (Range is from 172.30.1.0 to 172.30.1.255)

    And a lot more combinations you can try by your own.

    Login or Signup to reply.
  2. You mention a CIDR of 172.31.48.0/20. It goes from 172.31.48.0 to 172.31.63.255.

    The CIDR of 172.31.56.0/22 goes from 172.31.56.0 to 172.31.59.255.

    As you can see, they overlap.

    When dealing with CIDRs, it’s a good idea to use a CIDR calculator such as cidr.xyz.

    By the way, a Default VPC normally has a CIDR of 172.30.0.0/16. The CIDRs you mention are unlikely to be an AWS-provided Default VPC.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search