I have a couple of c5.large instances with two network interfaces each, running the latest Amazon Linux 2 AMI as of 2018-03. They used to have 8 IP addresses on each interface, which is now changed to 7. When adding IP addresses and interfaces, this has properly updated on restarting services/rebooting as documented on Amazon's docs. Now, one of the instances, on the primary network interface, it still believes it has 8 IP addresses - the removed one still sticks around.
I have tried systemctl restart network and rebooting, to no avail.
Below is the relevant part of journalctl output. curling http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC1/local-ipv4s (with the relevant MAC for eth0) returns the correct 7 IP addresses, without the stale IP address, which is still stuck to the network interface. I notice that we only see "Rewriting rules" for eth1 and not eth0. Still, one instance is fine while the other is not.
network: Bringing up interface eth0: dhclient: DHCPREQUEST on eth0 to x.x.x.x port 67 (xid=0x509915e5) dhclient: DHCPACK from x.x.x.x (xid=0x509915e5) NET: /usr/sbin/dhclient-script : updated /etc/resolv.conf dhclient: bound to x.x.x.x -- renewal in 1364 seconds. ec2net: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC1/local-ipv4s network: Determining IP information for eth0... done. ec2net: [rewrite_aliases] Rewriting aliases of eth0 systemd: Started AWS CodeDeploy Host Agent. bash: /opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/appender.rb:139: warning: constant ::Fixnum is deprecated bash: /opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/logger.rb:295: warning: constant ::Fixnum is deprecated network: Determining IPv6 information for eth0... done. network: [ OK ] network: Bringing up interface eth1: dhclient: DHCPREQUEST on eth1 to x.x.x.x port 67 (xid=0xeeb9077) dhclient: DHCPACK from x.x.x.x (xid=0xeeb9077) ec2net: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC2/local-ipv4s ec2net: [rewrite_rules] Rewriting rules for eth1 dhclient: bound to x.x.x.x -- renewal in 1727 seconds. network: Determining IP information for eth1... done. ec2net: [get_meta] Trying to get http://x.x.x.x/latest/meta-data/network/interfaces/macs/MAC2/local-ipv4s ec2net: [rewrite_aliases] Rewriting aliases of eth1 dhclient: XMT: Solicit on eth0, interval 1060ms. network: Determining IPv6 information for eth1... done. network: [ OK ] systemd: Started LSB: Bring up/down networking. systemd: Starting Initial cloud-init job (metadata service crawler)... systemd: Reached target Network. systemd: Starting Network. systemd: Starting Postfix Mail Transport Agent... dhclient: XMT: Solicit on eth0, interval 2050ms. cloud-init: Cloud-init v. 0.7.9 running 'init' at Tue, 13 Feb 2018 13:28:18 +0000. Up 9.23 seconds. dhclient: XMT: Solicit on eth1, interval 1040ms. cloud-init: ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
EDIT: What I expect is that the interface should remove the unassigned IP address from the primary network interface on network restart (or at least on instance reboot). How do I get this working?
EDIT 2: Manually deleting the IP from the interface by
ip addr del x.x.x.x/20 dev eth0 removes it for the moment, but it comes back when I run
service network restart. Maybe there's some cached result that sticks...?