# Subnetting – Part 2: Finding all the subnets within a network

Following on from part one of this series where we went through the basics of subnetting, and we are going to expand on that by finding all of the available subnets within a class and prefix.

Again this can be found either using the binary or decimal ways, and we are going to go through both here.

### Finding all the subnets – Binary

1. Start by writing down the binary version of the classful network.
2. Separate the network and subnet parts of the number with one line, and the subnet and host parts with another line (I have actually bolded the number where the lines would be).
3. Calculate the number of subnets (including the zero-subnet and the broadcast subnet) using the method 2y where y is the number of subnet bits.
4. Write down y-1 copies of the binary network below the first one, leaving the subnet field blank.
5. Using the subnet field increment the values (001, 010, 011 etc)
6. Convert the binary numbers back to decimal

Again we are using the Odom book as the basis of this, so we are using the class B network 172.31.0.0, and a subnet mask of 255.255.224.0. we are using 3 subnet bits so there will be 23 subnets (if your algebra is as good as mine then this is the same as 2*2 = 4, 4*2 = 8).

 Subnet Octet 1 Octet 2 Octet 3 Octet 4 Network number/Subnet 0 10101100 00011111 00000000 00000000 2nd Subnet 10101100 00011111 00100000 00000000 3rd Subnet 10101100 00011111 01000000 00000000 4th Subnet 10101100 00011111 01100000 00000000 5th Subnet 10101100 00011111 10000000 00000000 6th Subnet 10101100 00011111 10100000 00000000 7th Subnet 10101100 00011111 11000000 00000000 8th Subnet (Broadcast) 10101100 00011111 11100000 00000000

Converting these back into decimal we would see that the networks within this subnet are: 172.31.0.0, 172.31.32.0, 172.31.64.0, 172.31.96.0, 172.31.128.0, 172.31.160.0, 172.31.192.0 and 172.31.224.0.

### Finding all the subnets – Decimal

The decimal way is very similar. As we saw with SLSM we look at the “interesting” octet. We know that 256-224 = 32 so we increment based on that.

So let’s look at this in a bit more detail.