How do I make DHCP ip address scopes in AWS?

609 Views Asked by At

I have a AWS VPC where the DHCP optionset gives me random addresses in the scope of the CIDR 10.128.1.0/24.

But I want to have the DHCP scope limited, so that I can use static private ip addresses for some of the servers and dynamic for another set of server, like

Static Server scope:

   10.128.1.1 .. 10.128.1.99

Dynamic Server scope:

   10.128.1.100 .. 10.128.1.200

I have tried using the aws ec2 create-dhcp-options but it doesn't give me the opportunity to limit any ip addresses.

The question is perhaps, Can it done? then of course how to, or should I think complete different when having this perhaps odd need and should do it another AWS way....?

1

There are 1 best solutions below

1
Azize On

You can't do this on AWS. It is common on standard networking, but not on cloud.

If you really need to use "static" IPs you can reserve the IP creating ENI, Elastic Network Interface, in advance.

When an ENI exist, even if it is available, the IP associated with ENI is already in use, so DHCP will not use it anymore

When you create an EC2 instance you can allow it to use DHCP to get an random IP or you can choose an available ENI.

Just notice some IPs are reserved by AWS, you can't create an ENI for it.

See the reserved IPs on documentation below: https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html#subnet-sizing