未指派的輔助 IP 卡在 AWS Linux EC2 上

未指派的輔助 IP 卡在 AWS Linux EC2 上

我有幾個 c5.large 實例,每個執行個體都有兩個網路接口,運行截至 2018 年 3 月最新的 Amazon Linux 2 AMI。他們曾經在每個介面上有 8 個 IP 位址,現在更改為 7 個。現在,其中一個實例在主網路介面上仍然認為自己有 8 個 IP 位址 - 已刪除的 IP 位址仍然存在。

我嘗試過 systemctl restart network 並重新啟動,但無濟於事。

以下是journalctl輸出的相關部分。冰壺http://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 位址。我怎樣才能讓它發揮作用?

ip addr del x.x.x.x/20 dev eth0編輯2:透過暫時刪除它來手動從介面中刪除IP ,但當我運行時它會回來service network restart。也許有一些快取的結果會保留......?

相關內容