If VPC is assigned CIDR block 172.31.0.0
/16, then I can create sub-nets within VPC, following this procedure:
172 . 31 . 0 . 0
255 . 255 . 0 . 0
11111111 11111111 00000000 00000000
In CIDR notation, we write 172.31.0.0
/16 where 16 is the # of left most bits that cannot be re-used for host addressing.
Take LSBit for second octet(shown below), because second octet has the last bit with mask 1
1---------1--------1------1 ------1-----1-----1-----1 (second octet mask)
128-----64------32-----16------8-----4-----2-----1 (mask bit position)
This LSBit(in bold) in second octet gives first sub-network and also the range(as shown below)
172.31.[1].0
+1 First subnet range( 172.31.1.1 to 172.31.1.255)
172.31.[2].0
+1 Second subnet range( 172.31.2.1 to 172.31.2.255)
172.31.[3].0
+1 Third subnet range( 172.31.3.1 to 172.31.3.255)
172.31.[4].0
+1 Fourth subnet range( 172.31.4.1 to 172.31.5.255)
172.31.[5].0
+1 Fifth subnet range( 172.31.5.1 to 172.31.5.255)
and so on....
So, CIDR 172.31.0.0
/16 assigned to VPC is already allocating subnets(shown above) and their possible IP range for each subnet.
Why again we assign another CIDR block 172.31.0.0
/24 for a subnet in VPC? as shown below...
/24
networks). – Ron Maupin Jan 05 '19 at 21:04