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.


  • Are you talking about EC2? AWS VPC is a completely different thing (more VPN/networkish stuff) – number5 Jul 27 '12 at 6:51
  • 2
    I believe Multiple IPs are possible in VPC only. – APZ Jul 27 '12 at 11:45

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

auto eth0
iface eth0 inet static

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
    up ip addr add dev eth0
  • Thanks for the reply, can you please tell me how is your solution better than mine, I am not a guru in networking and want to understand which approach is better. – APZ Jul 27 '12 at 11:46
  • 1
    @APZ Aliased interfaces (i.e. eth0:0) are a hack created by ifconfig in order to support multiple IP addresses. They are considered deprecated however, and iproute2 (i.e. the ip command) should be used instead to attach multiple IPs to a single interface, which is what my solution does. – mgorven Jul 27 '12 at 16:52
  • @mgorven Could you please explain the "20/24" part? Also, I am trying to add 4 IP addresses to two ENI's (for a total of 8 IPs). I can do it in the Amazon Linux AMI no problem (since Amazon gives you instructions in their documentation), but do you think this approach would work for that? Thanks! – chaimp Aug 31 '12 at 3:09
  • @jeffp The IP is; the /24 specifies the subnet mask, i.e. 24 bits make up the network part and 32-24=8 bits make up the host part. If you have a specific question you should ask a question though. – mgorven Aug 31 '12 at 7:11

I was finally able to figure out how to record second private IP for my AWS VPC machine: I appended this to /etc/network/interfaces:

auto eth0:0
iface eth0:0 inet static
    address 192.x.y.z

and then running ifup eth0:0

My ifconfig showed both eth0 and eth0:0 with correct private IPs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.