CompTIA Network+ N10-008 Topic: Module 9 – Addressing Networks with IPv4 Part 2
December 14, 2022

8. 9.7 The Need for Subnetting

If we’ve got lots and lots of network addresses to advertise and keep on our IP routing table, it could get a bit overwhelming. For example, the Internet currently, at the time of this recording, has a little over 8000 networks in its network routing table. That’s a lot. One thing we could do is take similar networks with a lot of bits in common and summarise those with a single advertisement. Take these four networks just as an example; these are private IP addresses. But consider these, and let’s see if we could advertise all four of these networks with a single advertisement. Here we have the binary representations of each network address. And you’ll start to notice, if you look, that they have a lot in common. Every bit in the first octet is identical for all four networks. Every bit in the second octet is identical for all four networks. And when we get into that third octet, let’s see, the first, the second, and the third bits are all identical. If we add up eight plus eight plus three, the first 19 bits are the same for all of these networks. So what if we said that these 19 bits are all the same?

Let’s advertise that as our network. We’ll say those are our network bits. And the remaining 13 bits—those are going to be the host bits. So that means we can have a subnet mask made up of 19 ones followed by 13 zeros. And if we convert each of those octets to its corresponding decimal value, we’ve got 255. 255. And what is one plus one plus one plus five zeros? That’s going to be a 224. That’s 128 plus 64 plus 32, which is 224. And a network address is where we have all of our host bits set to zero. So in this case, in the first set, we’ve got eight bits, and they are one followed by six zeros. Then we’ve got a 101-0100, and we’ve got all zeros for the other two octets. What are those values in decimal? Well, in decimal, those are going to be 192 and 1680. That’s the network address. We could advertise 192. If someone wanted to get to an IP address in any of these four networks, they could go wherever that route said to go when we advertised that route of 192, because it covers all four network addresses.

9. 9.8 Calculating Available Subnets

If we decide that we want to do subnetting, we want to add bits to a network’s default subnet mask so that we can take one network address space and chop it up into different subnets. Let’s do the math to determine how many subnets we create if I add a certain number of bits to a default subnet mask. And here’s the magic formula: The number of subnets we create can be determined by the formula two, raised to the power of S, where S is the number of borrowed bits. And that is a big term to write down in your notes. A borrowed bit is a bit that is added to a default subnet mask. Now, to know what the default subnet mask is, you need to be able to distinguish between a class A, a class B, and a class C address. Do you remember how you did that? You look at the first octet.

10. 9.9 Calculating Available Hosts

If we add bits to a default subnet mask for a network, we know that that’s going to take that one network address space and chop it up into multiple subnets. But within each subnet, we need to know, for design purposes, how many hosts we can have in that subnet. In other words, what is the number of usable or assignable IP addresses for each of those subnets? And we can calculate that with the formula “2 raised to the power of H minus two.” Now, why are we subtracting two?

11. 9.10 Subnetting Practice Exercise #1

In this video, I want to challenge you with a subnet and calculation. Specifically, here’s the challenge I have for you: It’s a design challenge. Let’s pretend that your company has been assigned the 172, 200-dot, zero-slash 16 network for use at one of its sites. By the way, the default subnet mask for a Class B network is slash 16. We know this is a Class B network because it’s got a 172 in the first octet. Remember, a Class B network has a first-octet value in the range of 128 through 191, and 172 does fall in that range. And you need to use a subnet mask that will accommodate 47 subnets while simultaneously maximizing the number of hosts that you can have per subnet. Now, your design challenge is to determine what subnet mask you should use. So imagine this. Let’s say that at this site, we’ve got 47 different departments that we each want to have their own subnet. Well, I couldn’t give a subnet mask that had maybe 30 bits in it, and that would give us way more than 47 available subnets. So that would meet that criterion. But it would only give us two usable addresses in each subnet, and we want to maximize the number of hosts per subnet.

So I’ve written out the powers of two here. Now, where does 47 fall? Well, it’s not a perfect match to anything, but you’ll notice it’s somewhere between five and six. If I used five borrowed bits, then that would give me 32 subnets. That’s not quite enough. We need to have 47 subnets supported, so five is not enough. Let’s go with six borrowed bits. That’s more than enough. But it has to be six, because if we go one less than that, that’s not enough. So since five is not enough, we’ve got to go with six borrowed bits. And since the value in the first octet of our network was 172, we know that’s a Class B network, and we know that a Class B network has a default subnet mask of 16 bits. And we just determined that we wanted to add six borrowed bits to give us 47 subnets. So what is our subnet mask going to be? It’s going to be the default subnet mask of 16 plus the six borrowed bits. 16 plus six is 22, So we could write the subnet mask as a 22, or we could write it in dotted decimal as 25525, 52520, 252. That comes from having a third octet with six binary ones followed by two binary zeros. In other words, we’ve got 128 plus 64 plus 32 plus 16, plus eight, plus four. That gives us 252. Is that what you got from your calculation? If so, congratulations.

12. 9.11 Subnetting Practice Exercise #2

In this video, I want to challenge you with a subnetting practise exercise. Here is the scenario: Your company has been assigned a Class B network. It’s 172, 200, dot 0, and it’s got the default slash 16 subnet mask. and you want to use that ClassB network at one of your sites.

So that’s the reason we subtract two. And here we have a table that we can just do on some scratch paper. Two raised to the power of two is four; two minus two is two. Two raised to the power of three is eight; two minus two is six; and so on and so forth. The question is, how many host bits are needed to accommodate 100 hosts? Well, six host bits is not quite enough. That only gives us 62 assignable addresses. However, seven would suffice. That gives us 126. That’s actually more than enough. But it’s the fewest number of host bits we can use that will still meet this criterion. So here’s our solution: We want to support 100 hosts. We can see from this table that that’s not enough. We’ve got to have seven host bits, even though it’s not a perfect match. We need to round up. And we know that an IP version 4 address has 32 bits in total. Well, if seven of those bits are host bits, how many bits do we have for network bits? That’s 32 minus seven. That’s 25 bits used for the network. In other words, we have a 25-bit subnet mask, which can be written as a slash 25 or in dotted decimal as 255-255-2551 hundred and 28. Remember the 255; that’s eight bits. So we have eight plus eight plus eight, which is 24 bits. And then we have one extra bit in that fourth octet, and that’s in the 128 column. So that’s 25 bits. This gives us 255.255.255.128 as our subnet mask once more.

13. 9.12 Calculating Usable Ranges of IPv4 Addresses

We know that if we add bits to the default subnet mask, that’s going to take that network and divide it up into different subnets. The question is, within each of those subnets, which IP addresses are we allowed to use and assign to the devices in that subnet?

That’s what we’re going to answer in this video. Remember, we cannot assign a network address. That’s where all the host bits are zeros. We cannot assign a directed broadcast address. That’s where all the host bits are located. So how do we know the networks that get created and what network addresses are usable within each of those networks or within each of those subnets? And to give us a visual, let’s start with a really simple example. Let’s take 172, 250, and zero. That’s a class B network with a default subnet mask of 16. If I apply a 24 subnet mask, in other words, I add eight network bits. That’s going to give me the following subnets: It’ll be 100 and 7225-0024-1024-2024 all the way up to 255 00:24.

You see, what we’re doing is counting by one in the third octet. The question is, how did we know to do that? That’s the secret to calculating what subnets get created. And there are a couple of terms I want you to put in your notes. The first term is an interesting octet. That is the last octet to contain one in the subnet mask. Remember, a subnet mask is a series of ones followed by a series of zeros. So, what octet does that particular lasing, the rightmost one, belong to? In our case, we had a 24-bit subnet mask. Here’s what that looks like: We see that the last octet to contain a one is that third octet. It’s full of ones. That means, in our simple example, the third octet is the interesting octet. The next term I want you to write in your notes is “block size.” We’re going to be counting by some value in the interesting octet. But what is that value? The value is the block size. We count by the block size in the interesting octet. And the way to calculate the block size is to take 256, and then you subtract whatever the subnet value is in that interesting octet. In our case, the subnet mask was 255-255-2550. We said that the third octet was the interesting octet.

So that means the value of the interesting octet is 255. I’ve got it highlighted for you on the screen. Let’s calculate the block size. What is 256 minus 255? It’s the one that’s going to be our block size. So we’re going to count by one in the third octet. We’re counting by the block size in the interesting octet. That’s how we get these different subnets. And these are our network addresses. Remember that to get a network address, you set all of the host bits to zero. We’re not going to be allowed to assign those network addresses to a host in that network. And let’s take a look, for example, at the network address of 107 225-0024. We know that that itself is a subnet address. All the host bits are set to zero. But we’re also prohibited from assigning an undirected broadcast address to a host. Let’s set all the host bits to one and figure out what that directed broadcast address is. The network address we specified for this subnet is now 172 250 zero. And if we put that in binary, it looks like this: