When creating a Virtual Private Cloud (VPC) within AWS, you need to understand how IP addressing works. This guide will help you design an IP scheme suitable for deploying three private and three public subnets within your AWS infrastructure.
IP Addressing Basics
Before we start designing our subnets, let’s go over some IP addressing basics using a Class C network example:
In this scenario, there are 32 addresses in total, with 30 usable by hosts after excluding the network and broadcast addresses.
IP Design for AWS
Now, let’s create a design for three private and three public subnets within a VPC. We’ll base this off the assumption that the starting IP address is 10.72.1.0
:
VPC CIDR
IPV4 CIDR: 10.72.1.0/23
Private Subnets
- Private Subnet 1:
- Network Address:
10.72.1.0
- Usable Host Range:
10.72.1.1 - 10.72.1.30
- Broadcast Address:
10.72.1.31
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
- Private Subnet 2:
- Network Address:
10.72.1.32
- Usable Host Range:
10.72.1.33 - 10.72.1.62
- Broadcast Address:
10.72.1.63
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
- Private Subnet 3:
- Network Address:
10.72.1.64
- Usable Host Range:
10.72.1.65 - 10.72.1.94
- Broadcast Address:
10.72.1.95
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
Public Subnets
- Public Subnet 1:
- Network Address:
10.72.1.96
- Usable Host Range:
10.72.1.97 - 10.72.1.126
- Broadcast Address:
10.72.1.127
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
- Public Subnet 2:
- Network Address:
10.72.1.128
- Usable Host Range:
10.72.1.129 - 10.72.1.158
- Broadcast Address:
10.72.1.159
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
- Public Subnet 3:
- Network Address:
10.72.1.160
- Usable Host Range:
10.72.1.161 - 10.72.1.190
- Broadcast Address:
10.72.1.191
- Subnet Mask:
255.255.255.224
- CIDR Notation:
/27
- Network Address:
With the above configuration, each subnet supports 30 usable IP addresses. It’s important to remember that AWS reserves the first four IP addresses and the last one in each subnet, so only 25 IPs will be usable for EC2 instances or other resources within each subnet.
Hold on! There are more examples..
Assuming you want three separate VPCs for three applications with the specified CIDR ranges and each VPC having three private subnets and three public subnets, you can set it up as follows:
App1 VPC:
VPC CIDR: 10.70.1.0/23
Private Subnets:
Network Address: 10.70.1.0/27
Network Address: 10.70.1.32/27
Network Address: 10.70.1.64/27
Public Subnets:
Network Address: 10.70.1.96/27
Network Address: 10.70.1.128/27
Network Address: 10.70.1.160/27
App2 VPC:
VPC CIDR: 10.71.2.0/23
Private Subnets:
Network Address: 10.71.2.0/27
Network Address: 10.71.2.32/27
Network Address: 10.71.2.64/27
Public Subnets:
Network Address: 10.71.2.96/27
Network Address: 10.71.2.128/27
Network Address: 10.71.2.160/27
App3 VPC:
VPC CIDR: 10.72.3.0/23
Private Subnets:
Network Address: 10.72.3.0/27
Network Address: 10.72.3.32/27
Network Address: 10.72.3.64/27
Public Subnets:
Network Address: 10.72.3.96/27
Network Address: 10.72.3.128/27
Network Address: 10.72.3.160/27
Note: Each VPC CIDR range is unique, and does not cause overlapping, as each VPC and its associated subnets have distinct CIDR ranges. Each VPC and its subnets are isolated from each other, ensuring there is no IP address conflict.
Easy Calculator for dividing VPC Subnets
Please consider dealing with IP overlaps.
Conclusion
This IP addressing design allows for clear segmentation of resources within a VPC in AWS. By following this structure, you can ensure proper setup of six subnets – three designated as private and three as public – to support various types of workloads. This model follows best practices for cloud architecture, allowing for high availability and fault tolerance.
Tags: aws, CIDR, ClassCNetworks, CloudInfrastructure, IPAddressing, NetworkDesign, PrivateSubnets, PublicSubnets, Subnetting, VPC