1

How do I know what the Amazon DHCP server range for dynamic IP allocation is inside of my VPC? For example, I have a 172.31.32.0/20 network and I'd like to allocate a private permanent IP - which range I should choose to avoid collision with the DHCP range?

PS: I use Linux network aliases for adding a second static IP to eth0 (1st "Manage Private IP Adresses" on EC2 console and 2nd - adding appropriate alias config to Linux)

kasperd
  • 29,894
  • 16
  • 72
  • 122
  • possible duplicate of [Assign a static private ip to an EC2 instance](http://serverfault.com/questions/592512/assign-a-static-private-ip-to-an-ec2-instance) – MadHatter May 25 '14 at 07:53
  • 2
    MadHatter, my question is different - I do use VPC and I was able to add second static private IP using Linux eth alias. But I want to be sure that my addresses won't be in conflict with Amazon DHCP server range. – Vitaly Karasik DevOps May 25 '14 at 08:20
  • 2
    I'm sorry, Vitaly, I had missed that subtlety. I have withdrawn my close vote and agree that, to me at least, this is a different question. – MadHatter May 25 '14 at 08:53

1 Answers1

2

In a VPC, Amazon's IP range for your server is whatever you tell them to use in the subnet you've put the server in. They reserve a few addresses (I think three) for their own use for DNS and routing and so on, but they'll use the whole of the rest of the subnet range. If you want to use a static address, assign it to the instance (or network interface) when you create it, and it then won't be assigned as a dynamic address.

Mike Scott
  • 7,903
  • 29
  • 26
  • Is there a way to assign a static *private* address to the machine? – Adam Matan May 25 '14 at 08:30
  • Mike, thank you. I'd like to *reserve* some IP range for static allocation; let's say 100 IPs for using with my appservers in the future. Right now I have just a few appservers, so I cannot assign IPs right now. – Vitaly Karasik DevOps May 25 '14 at 08:31
  • 1
    @Vitaly You can't reserve a range, I'm afraid. The best you can do is hold back a whole subnet and use that subnet for your future requirement. – Mike Scott May 25 '14 at 08:36
  • @AdamMatan I'm talking about private addresses in this answer -- for public addresses you assign an Elastic IP address, and you'll never get a consecutive range of addresses. – Mike Scott May 25 '14 at 08:36
  • @MikeScott sorry, my bad. I just don't seem to understand the mechanism of assigning a private IP to an instance. It's quite straightforward with public ones, but private ones require Elastic Network Interfaces which are quote confusing. http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ElasticNetworkInterfaces.html – Adam Matan May 25 '14 at 08:42
  • @AdamMatan If you just want one private IP address for an instance, assign it when you create the instance, and Amazon will take care of creating an appropriate ENI for you. Or don't even do that and let Amazon assign the IP address as well, which is usually all that you need. – Mike Scott May 25 '14 at 08:52