September 14, 2020 / Nirav Shah
When you create a custom VPC, your VPC is automatically configured to the AWS provided DNS server, and this is used to resolve public DNS host-names and it’s used for host-name resolution. It is also used by the instances within your custom VPC which are communicating over the internet. And we already know that AWS consumes five IP addresses in CIDR blocks.
For example If you create a VPC with CIDR block 10.0.0.0/24, it supports 256 IP addresses. You can break this CIDR block into two subnets, each supporting 128 IP addresses. One subnet uses CIDR block 10.0.0.0/25 (for addresses 10.0.0.0 – 10.0.0.127) and the other uses CIDR block 10.0.0.128/25 (for addresses 10.0.0.128 – 10.0.0.255).
The first four IP addresses and the last IP address in each subnet CIDR block are not available for you to use, and cannot be assigned to an instance. Now as per the documentation, in a subnet with CIDR block 10.0.0.0/24, the following five IP addresses are reserved.
But if you don’t want to use the AWS provided DNS server, and instead, you want to use your own custom DNS server. How can you achieve this?
Login to your AWS console and go to the VPC section.
After creating your Custom VPC, Click on “action” and click on “Edit DNS resolution”.
Just uncheck the “enable” option and save it.
Go to the “DHCP option sets” and create a new DHCP options set.
Then at DHCP options, this is where you can add your domain name servers. You can enter up to four DNS server IP addresses, so you can add your own DNS servers right there.
And click on “DHCP options set”
Finally, your custom DNS server is created with your domain name.
After creating your DNS server, go to the VPC section and attach the DNS server to your custom VPC.
As a Director of Eternal Web Private Ltd an AWS consulting partner company, Nirav is responsible for its operations. AWS, cloud-computing and digital transformation are some of his favorite topics to talk about. His key focus is to help enterprises adopt technology, to solve their business problem with the right cloud solutions.
Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.