Skip to content

ec2 instance lost it's Private IPv4 address

2

I have an ec2 instance and it lost it's Private IPv4 address in random time. I can login via aws console and I can't see ip address for ens5 interface. When I restart the instance it gives back the ip address. Instance: Ubuntu 20.04.6 with 2 docker container: influxdb, grafana What can I do in this situation? Is it aws problem? Thanks.

4 Answers
1

I have this problem too on Ubuntu 24.04. It appears to coincide with a period of particularly high CPU and memory usage (a hungry application build). I thought the instance was crashing because an instance restart fixed it, but this time I decided to try the serial console. All working fine apart from the ens5 interface no longer had an IP address.

$ ip a
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 02:88:$$:@@:##:?? brd ??:??:??:??:??:??
    inet6 fe80::blah/64 scope link 
       valid_lft forever preferred_lft forever
$ ip r
10.0.255.0/24 dev lxdbr0 proto kernel scope link src 10.0.255.1 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown

(above edited due to re:Post rules)

$ ip link set dev ens5 down
$ ip link set dev ens5 up

Does NOT cure it. I found these syslog entries around the right time:

2025-05-12T20:41:36.985917+01:00 p2 systemd-networkd[642]: ens5: Could not set route: Connection timed out
2025-05-12T20:41:45.023905+01:00 p2 systemd-networkd[642]: ens5: Failed

The following brought it back:

$ service systemd-networkd restart
answered 10 months ago
1

This is the exact problem I'm having. After a high use to CPU, the internal (private) IP just dissapears, no alarms other than "Instance reachability check failed".. it even stops answering to stop/start commands from the web interface. Best solution is to use serial console and service systemd-networkd restart like @racitup suggested

answered 6 months ago
0

Losing a Private IPv4 address in an EC2 instance is unusual. When a new EC2 instance is launched into an IPv4 subnet the instance receives a primary private IP address from the IPv4 address range of the subnet. A private IPv4 address, regardless of whether it is a primary or secondary address, remains associated with the network interface when the instance is stopped and started, or hibernated and started, and is only released when the instance is terminated

Related link for additional support: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html

In case you are facing an unexpected behavior different to the explanation above, I suggest you also consider checking the EC2 status. Make sure that there are no ongoing incidents in the AWS region where your EC2 is hosted. AWS's status page will have this information.

https://status.aws.amazon.com

If you observed an unexpected behavior but the EC2 service was up and running on your region during your considered timestamp, as next troubleshooting step I would suggest checking the EC2 Instance Logs. You can use the AWS Console to get the system log or you can SSH into the instance and check the logs. Look for any errors or messages that might indicate what happened to the network interface. You can try using 'dmesg' or try looking at the logs in '/var/log/'

If all else fails and the issue persists, consider contacting AWS Support to further deep dive into your issues.

I hope that helps,

Rocky

AWS
EXPERT
answered 3 years ago
  • @AWS-Rocky - see my answer to this below, this is a serious issue with your platform easily reproducible if CPU is maxed out for a period of time (I regularly have to do large node vite builds which cause the IP address to be lost).

    Please raise it as an internal issue for fixing.

0

I have the same issue, in my case the session manager client dies and the instance is not reachable anymore.

answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.