chellathurai
chellathurai

Reputation: 115

EC2 host unreachable on secondary private address

I have a subnet(s1) in my VPC.Say subnet1 at the range of 10.1.1.0/24,I have 3 machines(m1,m2,m3) launched which has three private address(p1,p2,p3).m1 also has an elastic IP address to reach the machine from Internet.I just need an secondary private address(p4) that need to be associated with (m2 or m3) one at a time.P4 is choosen manually(just an unused address in same subnet) for load balancing stuffs.
The secondary ip association is coordinated by scripts so (p4) wont be bound to two machines at a time.

I am binding that p4 by ifconfig eth0:1 p4 netmask mask up And I publish it by send_arp. This same setup works in my local setup.But I can't made to work in AWS environment.
Even after calling send_arp done arp -a shows that mac address is incomplete.
I need to access m2 or m3 by secondary private Ip address from m1
Is that even possible in the AWS environment?

Upvotes: 0

Views: 766

Answers (1)

Ervin Szilagyi
Ervin Szilagyi

Reputation: 16775

In AWS every private IP address is attached to an ENI (Elastic Network Interface). When we create an EC2 instance, AWS assigns an ENI to our instance, but if we want to have multiple IP addresses, we can create our own ENIs and assign them to our EC2 instance.

In order to create an ENI, we can go in the AWS console to EC2 -> Network & Security (left tab) -> Network Interfaces -> Create Network Interface. After a network interface is created, it can be assigned manually, or your case you can use a script to assign it to one your EC2 instances (more info in the docs).

After an ENI is assigned to an instance, we should be able to see it inside the instance by simple running an ifconfig -a. There is no need for other ifconfig adjustments (at least in case of Amazon Linux 2, I did not try for other distros).

Upvotes: 1

Related Questions