简体   繁体   English

无法访问 Amazon EC2 上的辅助 IP

[英]Secondary IP on Amazon EC2 unreachable

I've added a secondary private IP address to my EC2 instance and associated a new elastic IP with it.我已向我的 EC2 实例添加了一个辅助私有 IP 地址,并为其关联了一个新的弹性 IP。

My EC2 Instance now lists a single "Public IP" (the original public, elastic, IP) and 2 "Elastic IPs" (the original and the new one I've added)我的 EC2 实例现在列出了一个“公共 IP”(原始公共、弹性、IP)和 2 个“弹性 IP”(我添加的原始 IP 和新 IP)

All good I thought but I can't connect to the server using either HTTP or SSH at this new elastic IP.我认为一切都很好,但我无法在这个新的弹性 IP 上使用 HTTP 或 SSH 连接到服务器。

I'm guessing that the single security group that's attached isn't being applied to the new elastic IP.我猜测附加的单个安全组没有应用于新的弹性 IP。

Looking for suggestions of how to debug this (logs?) or make sure the security group applies to both elastic IPs?寻找有关如何调试此(日志?)或确保安全组适用于两个弹性 IP 的建议?

Could it be because the new elastic IP isn't listed as "Public IP" ?可能是因为新的弹性 IP 没有列为“公共 IP”? It's confusing having multiple definitions of what's "public".对什么是“公共”有多种定义令人困惑。 I've been assuming Elastic = Public我一直假设 Elastic = Public

EDIT: The server is running ubuntu 14.04.3 LTS编辑:服务器正在运行 ubuntu 14.04.3 LTS

If you are using Ubuntu 16.04,just open the interface configuration file /etc/network/interfaces.d/50-cloud-init.cfg如果您使用的是 Ubuntu 16.04,只需打开接口配置文件 /etc/network/interfaces.d/50-cloud-init.cfg

Append the below lines with existing network config使用现有的网络配置附加以下行

auto eth0:1
iface eth0:1 inet static
address 172.30.1.123

auto eth0:2
iface eth0:2 inet static
address 172.30.1.124

Where 172.30.123 and 172.30.124 are your secondary private IPs, then restart the service.其中 172.30.123 和 172.30.124 是您的辅助私有 IP,然后重新启动服务。

$ sudo systemctl restart networking

Then, you can check that it's ok by ifconfig:然后,您可以通过 ifconfig 检查它是否正常:

$ sudo ifconfig | fgrep -A2 eth0:1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM