重叠子网CIDR块问题

huangapple go评论54阅读模式
英文:

Overlapping subnet CIDR block issue

问题

我试图在默认VPC内创建一个子网。
我正在使用的IPv4 CIDR块是172.31.56.0/22,但它不断地提示与现有子网CIDR块重叠:172.31.48.0/20。
我做错了什么?

我尝试过/24,仍然出现相同的错误。

英文:

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.

答案1

得分: 1

让我们看下面的图片来理解CIDR是如何工作的。

重叠子网CIDR块问题

您现有的子网CIDR是172.31.48.0/20,这意味着它拥有2的12次方个IP地址,即等于4096个。

以下是您现有子网的范围。从https://www.ipaddressguide.com/cidr网站截取的屏幕截图。

重叠子网CIDR块问题

所以,现在如果您想创建一个拥有256个IP地址的新子网,您可以在172.31.48.0之前或172.31.63.255之后创建它。

例如,以下CIDR示例将适用于您:

  • 172.30.0.0/24(范围从172.30.0.0到172.30.0.255)
  • 172.30.1.0/24(范围从172.30.1.0到172.30.1.255)

还有很多组合可以自己尝试。

英文:

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

重叠子网CIDR块问题

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.

重叠子网CIDR块问题

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.

答案2

得分: 0

你提到了一个CIDR地址172.31.48.0/20。它从172.31.48.0172.31.63.255

CIDR地址172.31.56.0/22172.31.56.0172.31.59.255

正如你所看到的,它们重叠。

在处理CIDR地址时,使用CIDR计算器,如cidr.xyz,是一个好主意。

顺便说一下,默认VPC通常具有CIDR地址172.30.0.0/16。你提到的CIDR地址不太可能是AWS提供的默认VPC。

英文:

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.

huangapple
  • 本文由 发表于 2023年5月28日 15:37:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76350435.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定