September 14, 2020 / Eternal Team
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.