未分配的辅助 IP 卡在 AWS Linux EC2 上

未分配的辅助 IP 卡在 AWS Linux EC2 上

我有几个 c5.large 实例,每个实例有两个网络接口,运行截至 2018-03 的最新 Amazon Linux 2 AMI。它们以前每个接口有 8 个 IP 地址,现在更改为 7 个。添加 IP 地址和接口时,在重新启动服务/重新启动时会正确更新,如 Amazon 文档中所述。现在,其中一个实例在主网络接口上仍然认为它有 8 个 IP 地址 - 已删除的 IP 地址仍然存在。

我尝试过 systemctl restart network 并重新启动,但无济于事。

以下是 journalctl 输出的相关部分。curlinghttp://xxxx/latest/meta-data/network/interfaces/macs/MAC1/local-ipv4s(具有 eth0 的相关 MAC)返回正确的 7 个 IP 地址,没有过时的 IP 地址,该地址仍然停留在网络接口上。我注意到我们只看到 eth1 的“重写规则”,而不是 eth0。不过,一个实例没问题,而另一个实例则有问题。

 network[1829]: Bringing up interface eth0:
 dhclient[1982]: DHCPREQUEST on eth0 to x.x.x.x port 67 (xid=0x509915e5)
 dhclient[1982]: DHCPACK from x.x.x.x (xid=0x509915e5)
 NET[2026]: /usr/sbin/dhclient-script : updated /etc/resolv.conf
 dhclient[1982]: bound to x.x.x.x -- renewal in 1364 seconds.
 ec2net[2043]: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC1/local-ipv4s
 network[1829]: Determining IP information for eth0... done.
 ec2net[2061]: [rewrite_aliases] Rewriting aliases of eth0
 systemd[1]: Started AWS CodeDeploy Host Agent.
 bash[1826]: /opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/appender.rb:139: warning: constant ::Fixnum is deprecated
 bash[1826]: /opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/logger.rb:295: warning: constant ::Fixnum is deprecated
 network[1829]: Determining IPv6 information for eth0... done.
 network[1829]: [  OK  ]
 network[1829]: Bringing up interface eth1:
 dhclient[2217]: DHCPREQUEST on eth1 to x.x.x.x port 67 (xid=0xeeb9077)
 dhclient[2217]: DHCPACK from x.x.x.x (xid=0xeeb9077)
 ec2net[2262]: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC2/local-ipv4s
 ec2net[2271]: [rewrite_rules] Rewriting rules for eth1
 dhclient[2217]: bound to x.x.x.x -- renewal in 1727 seconds.
 network[1829]: Determining IP information for eth1... done.
 ec2net[2293]: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC2/local-ipv4s
 ec2net[2300]: [rewrite_aliases] Rewriting aliases of eth1
 dhclient[2166]: XMT: Solicit on eth0, interval 1060ms.
 network[1829]: Determining IPv6 information for eth1... done.
 network[1829]: [  OK  ]
 systemd[1]: Started LSB: Bring up/down networking.
 systemd[1]: Starting Initial cloud-init job (metadata service crawler)...
 systemd[1]: Reached target Network.
 systemd[1]: Starting Network.
 systemd[1]: Starting Postfix Mail Transport Agent...
 dhclient[2166]: XMT: Solicit on eth0, interval 2050ms.
 cloud-init[2477]: Cloud-init v. 0.7.9 running 'init' at Tue, 13 Feb 2018 13:28:18 +0000. Up 9.23 seconds.
 dhclient[2431]: XMT: Solicit on eth1, interval 1040ms.
 cloud-init[2477]: ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++

编辑:我期望接口在网络重启时(或至少在实例重启时)从主网络接口中删除未分配的 IP 地址。我该如何实现这一点?

编辑 2:通过手动从接口中删除 IPip addr del x.x.x.x/20 dev eth0暂时将其删除,但当我运行时它会回来service network restart。也许有一些缓存的结果坚持下来了……?

相关内容