AWS VPC Multiple IPs

amazon-web-services

I am trying to associate a secondary internal IP with my Amazon VPC small machine, I am using a Ubuntu based image with AMI ID:ami-6936fb00.
Problem is that I am unable to figure out how to configure my OS(Ubuntu) to record the second private IP address ( this is required as mentioned in the AWS Docs: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/using-instance-addressing.html#using-instance-addressing-eips)!

I have single ENI and have associated one extra private IP with it.

Any help would be appreciated.

Thanks

Best Answer

Your /etc/network/interfaces file probably has something like the following:

auto eth0
iface eth0 inet static
    address 192.0.2.10
    netmask 255.255.255.0
    gateway 192.168.2.1

This is what assigns the primary IP (it may also be DHCP). To assign a secondary IP add a post-up script to attach an additional address to eth0.

auto eth0
iface eth0 inet static
    address 192.0.2.10
    netmask 255.255.255.0
    gateway 192.168.2.1
    up ip addr add 192.168.2.20/24 dev eth0