0

I have a couple of questions regarding ENIs:

  1. Why I can't change auto-assigned private IP address on default ENI?

  2. What if I change the IP on eth0 inside the system manually? Will it work, or the interface will be ruined?

My goal is to understand these moments to understand how ENIs work and why it differs from the behavior of physical network adapters. I wanna dig a little bit deeper under the hood of ENIs.

2 Answers2

0

Why I can't change auto-assigned private IP address on default ENI?

Once an EC2 instance is launched, it's assigned a private IP address at boot time. An instance's private IP address will never change during the lifetime of that instance. As per AWS, when an instance is launched in EC2-Classic, it is automatically assigned a public IP address to the instance from the EC2-Classic public IPv4 address pool. This behavior cannot be modified.

For more details please refer : https://docs.rightscale.com/faq/clouds/aws/Can_the_public_or_private_IP_addresses_change_on_an_EC2_instance.html

What if I change the IP on eth0 inside the system manually? Will it work, or the interface will be ruined?

You can't manually disassociate the public IP address from your instance after launch. Instead, it's automatically released in certain cases, after which you cannot reuse it.

For more details please refer link below https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html

Nikhil
  • 118
  • 4
  • I've already read about that. But my goal is to understand why I can't change private primary IP on the default ENI and what will be if I do so inside operating system of an instance. – Konstantin Jun 16 '21 at 14:47
0
  1. Why I can't change auto-assigned private IP address on default ENI?

The primary ENI, cannot be changed. I assume that AWS uses the primary interface for a NAT purpose. However, if you attach another ENI you can change the IP address inside of a guess OS.

  1. What if I change the IP on eth0 inside the system manually? Will it work, or the interface will be ruined?

If you change it, you will interrupt the connection to an instance and the only way to fix the problem is to reboot the instance. The IP and MAC assignment is done a layer higher than the guest OS (check the link above).

This is not a secret that AWS uses Xen as a hypervisor. The ENI employ a driver which is called "netfront" [at the guest OS side] and "netback" [at the hypervisor side]. If you want to delve a bit deeper under the hood of ENIs, you need to study this documentation https://wiki.xenproject.org/wiki/Xen_Networking and https://wiki.xenproject.org/wiki/Xen_Project_Software_Overview

I hope, I have shed some light on the topic.

  • Awesome! That's all I wanted to know! Thank you very much. Unfortunately, I can't mark you answer as the solution because of my low reputation. – Konstantin Jun 20 '21 at 07:39
  • Great! I am glad that I could help. Regarding marking my answer, I see two options: 1. You will do it after you reach a high reputation. 2. I hope another member with an appropriate reputation level will do it after he or she read my answer. – John Malloc Jun 20 '21 at 16:32