AWS 是否保留供其使用的私有 IPv4 范围?

Are there private IPv4 ranges AWS reserves for its use?

当我们创建VPC时,我们通常会为其分配一个私有的IPv4地址范围,如RFC 1918

我假设互联网网关、NAT 网关等托管在 AWS 管理的 VPC 上,因为它们具有高可用性和可扩展性,就像客户在 AWS 上设计服务的方式一样。

AWS 是否保留私有 IPv4 范围以供其用于解决客户的 VPC 与其托管 Internet 网关/NAT 网关的 VPC 之间的重叠问题?如何管理 CIDR 重叠?

私有IP地址可以在不同的网络中重复使用,不能在public中使用,这就是为什么它被称为私有。

如果您使用 AWS 服务并且它位于 VPC 中,它将获得您的 CIDR 范围内的 IP 地址。否则,它将在 AWS 网络中分配。

是的,AWS 可以通过一些方式在您的 VPC 中保留 IP 地址:)。

  1. 首先,互联网网关实际上并没有用完您VPC中的地址。 vpc 路由器基本上负责到 internet 网关的路由(更多关于下面的 vpc 路由器)。我猜他们使用各种花哨的网络覆盖和技巧来处理这种流量。不幸的是,我不是网络专家,无法了解他们为此使用的确切技术。
  2. 创建 NAT 网关时,AWS 实际上会在您的子网内创建一个弹性网络接口,并附加一个私有 IP 地址。在 EC2 控制台中转到 'elastic network interface' 视图时,您可以看到这些。显然,您不能重复使用这些地址。
  3. 第三,aws实际上为每个子网保留了几个地址。来自 aws 文档:

The first four IP addresses and the last IP address in each subnet CIDR block are not available for you to use, and cannot be assigned to an instance. For example, in a subnet with CIDR block 10.0.0.0/24, the following five IP addresses are reserved:

  • 10.0.0.0: Network address.
  • 10.0.0.1: Reserved by AWS for the VPC router.
  • 10.0.0.2: Reserved by AWS. The IP address of the DNS server is the base of the VPC network range plus two. For VPCs with multiple CIDR blocks, the IP address of the DNS server is located in the primary CIDR. We also reserve the base of each subnet range plus two for all CIDR blocks in the VPC. For more information, see Amazon DNS server.
  • 10.0.0.3: Reserved by AWS for future use.
  • 10.0.0.255: Network broadcast address. We do not support broadcast in a VPC, therefore we reserve this address. If you create a VPC or subnet using a command line tool or the Amazon EC2 API, the CIDR block is automatically modified to its canonical form. For example, if you specify 100.68.0.18/18 for the CIDR block, we create a CIDR block of 100.68.0.0/18.

所以简而言之,vpc 路由器负责将请求路由到 AWS 互联网网关,NAT 网关有自己的弹性网络接口,还有一些其他地址也被保留。

您似乎在询问客户 VPC 与用于 'run' AWS 的实际网络之间的重叠。但是,没有这样的重叠。

VPC 中的所有网络都是虚拟的。部署在 VPC 内的基础设施从 VPC 的 CIDR 范围内获得 IP 地址。例如,NAT 网关通过弹性网络接口 (ENI) 连接到 VPC,它使用 VPC 内的私有 IP 地址。这允许它与 VPC 中的其他资源通信,例如 EC2 实例、RDS 数据库和负载平衡器。

Internet 网关不会 使用任何私有 IP 地址。它只是一个VPC和Internet之间的路由概念。

AWS 用于运行服务的实际设备在存在 'outside of' 个 VPC 的单独网络上运行。