AWS Internet网关的公共IP [英] Public IP of AWS Internet gateway

查看:143
本文介绍了AWS Internet网关的公共IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道AWS Internet网关的公共IP.我的客户需要它来做IP白名单.我怎么才能得到它?我的实例直接面对Internet,并且没有通过任何NAT网关进行路由.根据我的理解,公共IP应该是EC2实例的弹性IP,该EC2实例连接到我的客户端.有人可以确保我的理解吗?

I would like to know the public IP of AWS internet gateway. My client needs it to do an IP whitelist. How can I get it? My instance is faced to the internet directly and didn't route via any NAT gateway. From my understanding, The public IP should be the elastic IP of EC2 instance, which connects to my client. Can any guy make sure of my understanding?

谢谢

推荐答案

您是正确的.

Internet网关是VPC与Internet之间的逻辑连接.如果没有Internet网关,则VPC与Internet之间没有连接.

An Internet Gateway is a logical connection between a VPC and the Internet. If there is no Internet Gateway, then there is no connection between the VPC and the Internet.

VPC中的每个Amazon EC2实例都有一个私有IP地址.他们可以可选地也具有公共IP地址.可以是启动实例时分配的随机值,也可以是为实例分配静态的弹性IP地址.

Every Amazon EC2 instance in a VPC has a private IP address. They can optionally also have a public IP address. This can either be a random one assigned when an instance is started, or a static Elastic IP address can be assigned to the instance.

实际上,这些公共IP地址已分配给弹性网络接口(ENI).一个实例可以有多个ENI.

Actually, these public IP addresses are assigned to an Elastic Network Interface (ENI). An instance can have multiple ENIs.

实例本身实际上并不知道"它具有公用IP地址/弹性IP地址.相反,当流量来自Internet并发往公共IP地址时,Internet网关会执行反向NAT ,然后将流量发送到实例的私有IP地址.同样,从实例到Internet网关的任何流量都来自实例的私有IP地址,然后Internet网关将其转发为来自实例的公共IP地址.

The instance itself doesn't actually 'know' that it has a public IP address / Elastic IP address. Instead, when traffic comes from the Internet destined for the public IP address, the Internet Gateway performs a reverse NAT and sends the traffic to the private IP address of the instance. Similarly, any traffic going from the instance to the Internet Gateway comes from the private IP address of the instance, which the Internet Gateway then forwards as coming from the instance's public IP address.

因此,Internet网关拥有"公用IP地址,但将其转发给实例.这一切都非常神奇,因此有时更容易将其想象为具有公共IP地址的实例.

Thus, the Internet Gateway 'owns' the public IP address, but forwards it to the instance. It's all quite magical, so sometimes it's just easier to imagine as the instance having the public IP address.

此方法的一个好处是弹性IP地址可以重新分配给另一个实例,流量将立即流到新实例,而无需在旧"或新"实例上进行任何配置更改.他们只是通过专用IP地址获得流量,而不知道涉及公共IP地址.

One benefit of this method is that an Elastic IP address can be reassigned to another instance and traffic will immediately flow to the new instance without any configuration changes on the 'old' or 'new' instance. They just get traffic via their private IP addresses without knowing that a public IP address was involved.

这篇关于AWS Internet网关的公共IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆