-1

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...

enter image description here

overexchange
  • 113
  • 5
  • Forget octets, they are meaningless. – Ron Maupin Jan 05 '19 at 20:52
  • @RonMaupin Yes in CIDR, octets are meaning less but, how would you know first subnet and its range, without knowing the octet having LSBit? – overexchange Jan 05 '19 at 20:54
  • Octets have nothing do do with addressing or subnetting; they are simply to make it easier for humans to read an IPv4 address. See this two-part answer about that. – Ron Maupin Jan 05 '19 at 20:56
  • @RonMaupin Do you agree with subnet ranges given in the query, to be correct? with /16 – overexchange Jan 05 '19 at 21:00
  • Based on what you have written, then I do not think you really understand subnetting. The answer I linked will explain it all. The second part of the answer covers subnetting, but you really need to understand the first part of the answer before you get that far. – Ron Maupin Jan 05 '19 at 21:03
  • Also, you seem to have a typo on what you call the fourth range (which is really the fifth range if you are using /24 networks). – Ron Maupin Jan 05 '19 at 21:04

1 Answers1

1

This is nothing special to VPC.

From the diagram, 172.31.0.0/16 is simply subnetted to 172.31.0.0/24, 172.31.1.0/24 and so on.

Check out the excellent answers Ron has linked to for a more detailed explanation.

Zac67
  • 84,333
  • 4
  • 69
  • 133