From the course: Cisco Networking Foundations: IP Addressing

Subnetting practice exercise #1

- [Instructor] Let's get some practice with our subnetting calculations. We'll go through this first practice exercise together, and then, in our next video, I'll challenge you to do one of your own. In this practice exercise, here's the problem we're challenged with. Your company has been assigned the 172.20.0.0/16 network for use at one of its sites. You need to use a subnet mask that will accommodate 47 subnets while simultaneously accommodating the maximum number of hosts per subnet. And the question we need to answer is what subnet mask will you use? Now notice when it says we need to have the maximum number of hosts per subnet, that means we should not use more bits in our subnet mask than needed. We have to accommodate 47 subnets, but let's not add any network bits beyond what's required to meet that criterion because the more subnet bits we add, the fewer number of hosts we can have for subnet. So let's go through the solution together. First, we might want to jot out on some scratch paper the number of subnets that get created when we borrow a certain number of bits. This is going to be the powers of two. Remember, the formula two raised to the power of s? That's the number of subnets that get created where s is the number of borrowed bits. If I don't borrow any bits, in other words, s equals zero, then the number of subnets we have is one. We haven't done any subnetting at all. We have our original network. So two raised to the power of zero, anything raised to the power of zero is a one. If we borrow one bit, two raised to the power of one is a two. If we borrow two bits, two raised to the power of two is four and so on. And in our case, we need to support 47 subnets. And none of these exactly equals 47. If I borrow five bits, that's not going to quite be enough. That would only give us 32. If I borrow six bits, that's more than enough. That would give us 64 available subnets. However, that is the fewest number of borrowed bits I can use and still meet the requirement of supporting 47 subnets. So we've got to go with six borrowed bits. And this is a Class B network. We know that because there's a 172 in the first octet. That's why I was saying earlier that it's critical to be able to recognize a class of IP address, because if we didn't know what class this was, we would not know what the default mask was that we would be adding these borrowed bits to. But we know this is a Class B network and a Class B network has 16 bits by default in its subnet mask. And we've determined that we need to borrow six bits in order to meet this design requirement. So if I add six bits to the default of 16 bits, that's going to give me a 22 bit subnet mask. And if we write that in dotted decimal, that's going to be a 255.255.252.0. That's the subnet mask that we should apply to support 47 subnets.

Contents