devgirl
devgirl

Reputation: 783

AWS VPC CIDR IP Address Subnet Calculation

I have a current vpc with the cidr 192.168.0.0/16 and subnets "192.168.0.0/24", "192.168.1.0/24","192.168.4.0/24", "192.168.5.0/24"

Upvotes: 1

Views: 1709

Answers (1)

Marcin
Marcin

Reputation: 238309

General recommendation for VPC CIDRS is in AWS docs:

- 10.0.0.0 - 10.255.255.255 
- 172.16.0.0 - 172.31.255.255 
- 192.168.0.0 - 192.168.255.255

So you can use any of these. Often, people use VPC CIDRs from the first range. So if you would like to do this as well, you could choose any CIDR from below (increment second digit if you want to use /16):

 - 10.0.0.0/16 
 - 10.1.0.0/16
 - 10.2.0.0/16
 - 10.3.0.0/16
 - ....
 - 10.255.0.0/16

From these, to get subnets (/24), you increment third digit. For example, for VPC CIDR 10.0.0.0/16, your subsets would be:

 - 10.0.0.0/24
 - 10.0.1.0/24
 - 10.0.2.0/24
 - 10.0.3.0/24
 - ....
 - 10.0.255.0/24

The individual resources in your subsets, e.g. instances, will get IPs using the forth digit.

Upvotes: 4

Related Questions