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 2^{y} 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 2^{3} 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.

1. Start with the classful network number

2. For the first subnet number, copy the entire network number – this is subnet zero

3. Find the octet that contains the entire subnet field (the interesting octet)

4. find the magic number by subtracting this octet from 256

5. Copy down the non-interesting octets onto the next line as the next subnet number. There should only be one octet that’s missing a value at this stage.

6. Start adding the magic number to the previous octet value, adding again and again as you go down the list

7. Repeat 5 and 6 until you get to 256. This subnet is not valid, so the one before this one will be the last valid one, and also the broadcast subnet.

Octet | Comments | ||||

1 | 2 | 3 | 4 | ||

Network Number | 172 | 31 | 0 | 0 | Step 1 |

Mask | 255 | 255 | 224 | 0 | 256-224=32 |

Subnet Zero | 172 | 31 | 0 | 0 | Step 2 |

1st Subnet | 172 | 31 | 32 | 0 | 0+32 (Step 5 and 6) |

2nd Subnet | 172 | 31 | 64 | 0 | 32+32 |

3rd Subnet | 172 | 31 | 96 | 0 | 64+32 |

4th Subnet | 172 | 31 | 128 | 0 | 96+32 |

5th Subnet | 172 | 31 | 160 | 0 | 128+32 |

6th Subnet | 172 | 31 | 192 | 0 | 160+32 |

7th Subnet | 172 | 31 | 224 | 0 | 192+32 (Broadcast subnet) |

Invalid Subnet | 172 | 31 | 256 | 0 | Invalid |

I’ll post some more examples on the subnetting PDF that will follow the last part of this series shortly. But before that, we have VLSM and Route Summarisation to complete.