### Prologue

I have held the now-retired CCENT before in the past and am currently preparing to start my CCNA revision. So, I thought I’d try and explain subnetting in my own way. I struggled with this initially and thought I’d write a little piece on how I managed to get it to click.

I’m not going to suggest this is the definitive way to subnet, there are other ways you can go about this (using binary calculation for example). Cisco and subnetting practitioners of a higher level than me may have a different take on the subject entirely, but this is what’s always worked for me!

So let’s get into it!

### IP Address Anatomy

Firstly – an IP address or a subnet mask contains 32 bits, which is split up into 4 blocks each containing 8 bits (a 1 or a 0); each one of these blocks is called an Octet. So the IP address or subnet mask you are using right now for example has 4 octets with 8 bits in each, totaling 32bits.

The table below shows an Octet (8 bits) each bit has been represented by a column in the table; their numerical values are in the headers above. The red 1’s and 0’s below represent a dummy number I have put in for this example.

This table is always the same; the headings never change. It always goes 128, 64, 32, 16, 8, 4, 2 and 1 in that order from left to right. (get used to drawing this out!) An example with a dummy number in red is shown below:

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|

1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |

As you can see from the table above; there is a “1” in the 128 column, the 32 column, the 8 column, and the 4 column, so we need to add up all of the values that have a 1 next to them!

**128 + 32 + 8 + 4 = 172**

So there’s your answer. 10101100 in binary translates to 172!

Incidentally, if you were to enter all 1’s for every column above you would arrive at the number 255, which is the largest 8-bit number you can get.

### Sample Question & Working

So, when you take a Cisco exam you may or may not come across a question like those that you can find on:

http:\\www.subnettingquestions.com. An example of the sort of question you can generally find on here is:

**Which subnet does host 172.26.132.157/22 belong to?**

So for those of you who don’t understand Slash Notation the “/22” at the end of the IP address in the question above is the subnet mask; but instead of “255.255.255.0” as you’re probably used to seeing, it’s shown in Slash or CIDR notation instead. The “22” after the slash refers to the number of 1’s in the subnet mask in its binary form, which looks like this:

**11111111.11111111.11111100.00000000**

Remember the table I drew earlier with 8 columns? this is 4 of them stuck side by side. The above is what the “/22” translates to in binary. The binary string above when translated back into numbers is **255.255.252.0**. If you draw that out into the table I showed you above – this is the result you’ll get… try it now before moving on!

You may also be given a traditional subject mask with the question rather than the slash/CIDR notation. In which case it’s important to work out what the slash/CIDR notation is for this too so if you were given **255.255.252.0** for example (get your table out!) You would draw out the following:

# | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|---|

255 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |

255 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |

252 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

And when you stick the results together you will have got: 11111111.11111111.11111100.00000000 which is the binary string of your subnet mask converted from the slash notation.

So to recap:

- 255.255.252.0
- /22
- 11111111.11111111.11111100.00000000

…are all the same thing! We have also been through how to get from one to the other.

### So, back to the Sample Question!

The sample question we had earlier is:

**Which subnet does host 172.26.132.157/22 belong to?**

I said that the first step was working out the subnet mask in binary, which we did, and the result was:

**11111111.11111111.11111100.00000000**

Now, the next step after the waffle I’ve produced is to **FIND THE INCREMENT** which isn’t as difficult as finding the holy grail thankfully.

The increment is found by finding the LAST ‘1’ in the subnet mask (the farthest on the right) and finding the value of that ‘1’. In the case of the example above the last ‘1’ is in the 3rd octet and has a value of ‘4’ within that octet.

That then is our increment, and that increment is present in the 3rd octet. From this point, we can find our subnet address ranges.

### Finding the Subnet Ranges

Right then, time for the punchline!

Get your original IP address which was 172.26.132.157 and as the increment was in the 3rd octet that we have just worked out we need to zero that octet and anything after it leaving us with **172.26.0.0** this is our first address.

Then we simply need to increase that address by the increment we established in the octet we identified so here goes:

**172.26.0.0 **plus our increment is **172.26.4.0** and we can carry that on now going on and on and on and on as below:

172.26.0.0

172.26.4.0

172.26.8.0

172.26.12.0

172.26.16.0

… and so on

These are the first addresses of your subnet ranges. From these, we can now work out the last address in your network ranges because the last one will obviously end 1 address before the next one starts. Which looks something like this:

First Address | Last Address |
---|---|

172.26.0.0 | 172.26.3.255 |

172.26.4.0 | 172.26.7.255 |

172.26.8.0 | 172.26.11.255 |

172.26.12.0 | 172.26.15.255 |

172.26.16.0 | 172.26.19.255 |

One last very important note; the addresses listed in the column on the left here **are not usable** as they are ‘Network Addresses’ and neither are the ones on the right because they are ‘Broadcast addresses’.

The first address of a subnet is always the network address and the last address of a subnet is always the broadcast so we can disregard these as they are not usable. This leaves us with:

First Usable Address | Last Usable Address |
---|---|

172.26.0.1 | 172.26.3.254 |

172.26.4.1 | 172.26.7.254 |

172.26.8.1 | 172.26.11.254 |

172.26.12.1 | 172.26.15.254 |

172.26.16.1 | 172.26.19.254 |

So there you have it! Usable network ranges!

Now I’m not going to bore you by typing it all out but the example I chose is quite far up number wise. I’m sure you get the picture so I’ll skip to the part we need:

First Usable Address | Last Usable Address |
---|---|

172.26.132.1 | 172.26.135.254 |

Above is the block of IP’s containing our address! So now all we need to do is simply answer the question!

**Which subnet does host 172.26.132.157/22 belong to?**

The answer is **172.26.132.0**

Because I believe in showing my working:

### Conclusion

In reality out there in the real world, you’ll just use a subnet calculator as I did just then to check my answer. The one I used can be found at https://bneijt.nl/pr/ip-subnet-calculator/

Unfortunately, Cisco won’t let you use one for the exam so you’ll need to have this nailed, because not only will you be expected to do this but you’ll need to do it quite quickly!

So, get practicing, and good luck!

A reminder that you can access sample questions to test yourself by going to old faithful http://www.subnettingquestions.com/