This post covers the fundamentals of subnetting in the AWS console and how to properly subnet your networks.
What is Subnetting
In AWS, subnetting is dividing your VPC (Virtual Private Cloud)network into smaller networks called subnets.
What is a Subnet
A subnet is a network within a network.
CIDR Block
To properly divide your VPC CIDR block into working subnets you must first understand what CIDR blocks are made up of.
CIDR blocks are made up of five numbers, the first four being the routing prefix and the last number with usually has a "/" before the number and it is called a netmask e.g (10.0.0.0/24). Each octet in the routing prefix separated by dots have 8 bit.
The net mask tells you how many of the 32 bit routing prefix must be fixed or allocated for the network identifier.
So in a /24 net mask the first three octets are fixed and the fourth one can change to give you a group of IP addresses that are consecutive to one another.
Calculating the number of available IP address in a CIDR block
For this example we will be using an IP address with a /24 net mask. Take the IP dress 10.0.0.0/24 the simple way to calculate the number of available IP addresses here would be
host bits = 32 - 24 = 8
total IPs = 2^8 = 256
Further subnetting of our VPC into a /27 network would mean we have 32 subnets to allocate per subnet which means we can have up to 8 subnets in the VPC.
Subnetting a /24 network
To make sure your subnets do not have overlapping IPs you can configure your IP ranges like this: The fist subnet can have an IP range of 10.0.0.0/27 - 10.0.0.32/27, the second subnet should then have IPs ranging from 10.0.0.33/27 - 10.0.0.64/27 the third subnet follows with would range from 10.0.0.65/27 - 10.0.0.96/27 etc. Each subnet in the /27 network start where the previous one ended.
Conclusion
Subnetting is the most crucial part of a cloud infrastructure and knowing how to subnet a network is a crucial skill for a cloud engineer. Learning and writing about this today has deepened my knowledge of subnets and I hope reading this post does the same for you too.
Top comments (0)