为什么要在私有 IPv4 地址空间之外使用 cidr 提供 VPC

Why would one provision a VPC using a cidr outside the private IPv4 address spaces

我看到 AWS 允许使用可以在私有 IPv4 地址之外的 cidr 创建 VPC space,但为什么要这样做呢?

这是为了托管 public 网络而提供的,虽然令人惊讶,但有些组织使用 public IP space 作为其内部网络。这些主要是拥有大量 public IP space 的组织。这通常是互联网早期的遗留问题。

来自AWS VPC FAQ

Q. What IP address ranges can I use within my VPC?

You can use any IPv4 address range, including RFC 1918 or publicly routable IP ranges for the primary CIDR block. For the secondary CIDR blocks certain restrictions apply. Publicly routable IP blocks are only reachable via the Virtual Private Gateway and cannot be accessed over the Internet through the Internet gateway. AWS does not advertise customer-owned IP address blocks to the Internet. You can allocate an Amazon-provided IPv6 CIDR block to a VPC by calling the relevant API or via the AWS Management Console.

正如我所提到的,通常会出现这种情况的情况是组织拥有一组 public IP space 并在其内部网络上使用这些 IP 地址。然后,这将允许来自内部网络的流量通过 Direct Connect 与 VPC 中的网络接口进行通信。这是一种非常罕见的情况,但这就是存在的原因。

虽然这可能并不常见,但世界上一些在 90 年代初期和中期获得了大量 IPv4 地址的最大公司仍在将其内部网络迁移到 RFC-1918 space。我怀疑这些大的潜在客户也以这种方式推动 AWS 支持 public 地址 space。请记住,RFC-1918 直到 1996 年才出现,即使到那时它也没有被广泛采用。

https://en.wikipedia.org/wiki/List_of_assigned_/8_IPv4_address_blocks

当某人为其 VPC 选择非私有 IP 范围 CIDR 时,可能是:

  • 为方便起见
  • 运行 个 CIDR,如果您继续分配 /16
  • 用于测试。我记得 CIDR 与 Microsoft 重叠的设置。他们这样做是为了路由本应流向 Microsoft 的流量在内部路由以分析数据
  • 当使用非私有 IP 范围 CIDR 时,流量永远不会从 AWS 外部路由到 VPC,因为没有路由器会有到 VPC 的路由。仅用于内部路由
  • 如果您只有一个私有子网(使用客户网关连接到您的公司网络)- a.k.a Scenario 4,您可以有任何 CIDR 范围。