Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine subnet IPv4 CIDR address in AWS?

How to determine subnet IPv4 CIDR address in AWS. Suppose my VPC CIDR block is 172.31.0.0/16 and I want to create a subnet with 172.31.1.0/16 but it says " *** is not within the range of ****/*. Please explain me how to determine CIDR?

like image 606
Kamakshya Avatar asked Dec 24 '22 21:12

Kamakshya


1 Answers

172.31.0.0/16 represents these IP ranges:

CIDR Range      172.31.0.0/16
Netmask         255.255.0.0
Wildcard Bits   0.0.255.255
First IP        172.31.0.0
Last IP         172.31.255.255
Total Host      65536

172.31.1.0/16 represents the same IP range because of the /16 subnet mask which would be like 172.31.1.0/255.255.0.0:

CIDR Range      172.31.1.0/16
Netmask         255.255.0.0
Wildcard Bits   0.0.255.255
First IP        172.31.0.0
Last IP         172.31.255.255
Total Host      65536

Therefore it's not a subset of 172.31.0.0/16.

Perhaps you'd be comfortable with 256 IPs per subnet? In which case you could use 172.31.1.0/24 which would allow the IP range of 172.31.1.0 - 172.31.1.255:

CIDR Range      172.31.1.0/24
Netmask         255.255.255.0
Wildcard Bits   0.0.0.255
First IP        172.31.1.0
Last IP         172.31.1.255
Total Host      256

See https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing.

like image 162
Dave Maple Avatar answered Jan 11 '23 04:01

Dave Maple