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[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++++++++++++++++++++++++++++

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...?

  • It would help to know what Linux distribution you're running – fholzer Mar 30 at 19:47
  • D'oh, missed to include it in the text. Amazon Linux 2, latest as of 2018-03. – Legogris Apr 6 at 8:46

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.