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

8. 9.7 The Need for Subnetting

We know that the different classes of IP addresses in the class A, class B, and class C ranges have a default subnet mask. However, we might want to alter that subnet mask. And in this video, we want to take a look at a couple of reasons we might want to do that. Take, for example, a 192 0224 classIce C network. And imagine we’re trying to interconnect a couple of sites. We’ve got router R1 at one of our locations, and we’ve got router R2 at another location. And this link between the sites only needs two IP addresses, doesn’t it? We could give R the IP address and have R have the IP address So what do we do with all of those other addresses? It seems like we’ve wasted addresses in the range of one hundred and ninety-two zeroes and two fifty-four. And this is with a class C network. What if we’ve been using a class A or a class B? You see, a class A network is going to have over 16 million available addresses. You probably don’t want to waste that on just a single link, a class B address with its default subnet mask of 16, which is going to give us over 650 assignable IP addresses. But the class C network that we’re using here is going to give us 254 IP addresses that are usable.

So if we don’t want to waste, in this case, 252 of those IP addresses, then we might want to adjust that subnet mask. What we can do is add bits to the subnet mask, and we can take that single class C network and break it up into different subnets, different network address spaces, or different VLANs. And to get from one subnet to another, we have to route. But this is a way that we could separate our departments within the company. For example, maybe we don’t want the HR department to share the same network as the Research and Development department when they’re looking at their local network to see what printers are available. They don’t want to see each other’s resources; we want to separate them. We could also do that for security reasons, so we can do some subnetting by adding bits to that default subnet mask. Another reason we might want to adjust that subnet mask is to do address summarization. Let’s say that we are an Internet service provider, and we’ve got all these different networks assigned to our clients that we’re advertising out to the Internet, or we’re advertising to another location within our data center.

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.

Now, there’s another type of address I want you to know about. It’s called a “directed broadcast address.” If I want to go to something, every device within this network of 192 can go to that network’s directed broadcast address. That’s where we have all of the host bits set to one. Here’s what that looks like in binary: And if we convert those values to decimal values, the directed broadcast address is going to be 192, 168, 31.255. Notice the 31 occurs because we’ve got three network bits, which happen to be zeros. In the case of a directed broadcast, all of the host bits are one. So in that third octet, we’ve got five ones. That’s going to be one plus two plus four plus eight plus 16. If you add all that up, that’s 31. And that’s a look at a couple of reasons we might want to adjust our subnet mask and do some subnetting. By the way, when we reduce the subnet length, as we’ve done in this example, that’s often referred to as “supernetting” instead of “subnetting,” where we’re taking bits away from the default subnet mask. But when we’re adding bits to a subnet mask—that’s most commonly referred to as “subnetting”—we’ve seen two reasons we might want to alter that subnet mask, and that is to avoid wasting IP addresses as well as to do address summarization.

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.

And if that first octet has a number in the range of one through 126, that’s class A, and it has an eight default subnet mask, whereas a class B network has a 128 through 191 in that first set, and it has a 16 default subnet mask, or a “classful mask,” as it’s sometimes called. And a classic network is going to have a value in the first ten in the range of 192 through 223, and it’s going to have a 24 default subnet mask. So let’s go through an example together. Let’s say that we have applied a subnet mask of 255.255.255.224 to a class C network of 192. 168 is the default subnet mask for a class C network. In fact, we would not have even had to be told that this is a class C network. We could have determined that on our own simply by looking at that first octet. 192. Ding, ding, ding. That should tell us that it’s a class C network with a default subnet mask of 24. But the question we want to answer here is, “How many subnets did we just create when we added this subnet mask to this network?” Let’s go through the math together. We need to determine what the class of the network is. And we’ve already talked about how we know it’s a class C network because it’s got a 192 in the first tab. And what is the default subnet mask, sometimes called the “natural mask,” for a class C network? It’s a 24.

We’ve got 24 bits. Now, the subnet mask is 255 dot 255, dot 255, dot 224. How many bits is that? Let’s put that in slash notation. Let’s see. If I say 128 plus 64 plus 32, that gives me 224. In other words, I’ve used the first three bits. In that fourth octet, I’m adding three bits to the default mask of 24 to give me a slash 27 mask. So how many bar bits do I have? Well, that’s how many bits I added to the natural or default mask; I had to add three bits to give me a 224. In that fourth octave, I added three bits to that default mask, a 24. And that gave me a 27-point mask. So those three bits we added are borrowed bits. Now, let’s plug and chug. Let’s put that three into the formula of “two raised to the power of S,” where S is the number of borrowed bits. “Two raised to the power of three.” That’s going to be eight. Two times two Two times two is an eight. So we have applied this 27-subnet mask to a class C network, and the result is that we have eight different subnets that we just created.

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?

Because within each subnet, there are two IP addresses that cannot be assigned to the host. One is the network address, and one is the directed broadcast address. The network address is where all the host bits are set to zeroes, and the directed broadcast address is where all of the host bits are set to one. Now, let’s go through an example. Let’s say that we’ve got a subnet mask of 255, 255, 255, 224. And that’s applied to a class C network of 192, 168, and 100:24. That’s the default or the natural subnet mask. And the question is, how many hosts can I assign to each of the subnets that we’re creating? Well, let’s do the math. The number of ones in the subnet mask that we have is 27. The first octet has eight ones. The next octet has eight ones. The next octet has eight ones. And then the 224, which is three additional ones. In other words, it’s 128 plus 64 plus 32. That gives us 224. So we know we have three bits in that fourth octet. So eight plus eight plus eight plus three, that’s 27.

And we know that an IP version 4 address has 32 bits total. So the question is, how many host bits do we have? Well, that’s going to be 32, minus the number of network bits, which is 27. 32 minus 27 equals five, indicating that the number of hosts must be calculated. We’re going to take two raised to the power of five, which is 32. And we’re going to subtract two, which gives us 30 usable hosts. Now, let’s review what a network address and a directed broadcast address are. We are, after all, removing two of our available hosts for these addresses. What are these addresses? Well, the network address is much like a street address. It identifies the network on which all of the devices on that network reside. They all share the same network address. And the network address can be calculated by setting all of the host bits in the network to zero. In this example, we’ve got an IP address of 10, or 1238. That means the first eight bits are network bits, and the last 24 bits are host bits. Well, to calculate the network address, we’re going to carry down those eight network bits. In other words, the first eight bits in the address.

But the last 24 bits are host bits. And for a network address, they’re all set to zero. So this is what it looks like in binary. What is the network address in decimal? Well, in our case, because we’ve got eight network bits and we’ve got 24 host bits, our network address is going to be 100 zero. What about the directed broadcast address? Well, it’s just the opposite. Instead of setting those 24 host bits to a zero, we set those 24 host bits to a one, and it’s going to look like this: And when we convert that to decimal, that’s going to give us a directed broadcast address of 10255. 255?255. And why do we need a directed broadcast address? This is a way for us to reach all devices within a subnet. If we have 15 computers that belong to this network, if I send a directed broadcast to ten addresses, that’s 255. It’s going to reach all of those computers.

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 the challenge is to come up with enough borrowed bits. In other words, enough bits were added to the default subnet mask of 16. Let’s come up with enough added bits to give us 47 subnets, but no more. We don’t want any more bits, because if we add more bits, that cuts down on the number of usable hosts that we have per subnet. So you might want to pause the video right now, and when you’ve done your calculation, you can resume and we’ll go through the solution together. All right, how did your calculation go? Let’s go through a solution together, shall we? To determine the number of borrowed bits that are required to accommodate 47 subnets, we could write out a tablet. That’s going to give us the power of two. If I don’t have any borrowed bits, 2 raised to the power of zero is a one. That’s what we have with the default subnet mask. The 16 subnet mask had zero blocked bits, and we had one network. If I had added one barred bit, that would have given me two subnets. If I added two barred bits, two raised to the power of two, that would have given me four subnets.

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.

However, you’re going to be breaking that up into different subnets for the different departments. But there’s a requirement. The subnets that you create by extending that subnet mask beyond 16 bits should each accommodate at least 100 hosts, because the longer you make your subnet mask, the fewer hosts you can assign to each subnet. So the question is, what is the subnet mask you would use to accommodate 100 hosts while not using more host bits than you need? Because if you use more host bits, you reduce the number of subnets you can create. So it’s sort of a balancing act. You might want to pause the video right now, do your calculation, and then resume, and we’ll go through a solution together. All right, let’s go through the solution to this design exercise. We want to accommodate 100 hosts, so we need enough host bits to give us 100 hosts. But we don’t want to have more host bits than are needed because that’s going to cut down on the number of subnets we can have. And the formula for the number of hosts we can have per subnet is given by the formula 2 raised to the power of H minus 2, where H is the number of host bits. Remember, we’re subtracting two because we’re not allowed to assign the network address or the directed broadcast address for a subnet. The network address is where all of the host bits are zeros. The directed broadcast address is where all of the host pits are ones.

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:

To calculate the directed broadcast address, we use a 24 bit subnet mask; we take the last eight bits, the host bits, and make those. And we allow all of the network address bits to flow through that subnet mask. And if we do our binary to decimal conversion, that’s going to give us a directed broadcast address for this particular subnet of 172, 250, and 255. And to determine the usable ranges of addresses for our subnets, we need to take everything that’s between that subnet’s network address and its direct broadcast address. What we can do is add a binary one to the network address, which will give us our first usable address. Let’s take, for example, the network address of 172 250 zero. We’ll put it in binary. All we do is add a binary one to that. That’s going to give us—I’ll show it to you in binary first, and then we’ll convert it to decimal. But that’s going to give us the first usable address for the subnet. It’s going to be a 172-250 one. We also need to know the last usable IP address in a subnet. And to calculate that, we’re going to subtract a binary one from the directed broadcast address. And we’ve already seen that the directed broadcast address for 172 250 dot 00:24 is 172-25-0255. Our host bits The last eight bits are set to ones. Here’s what that looks like in binary: And to calculate the last usable address in that subnet, we’re going to subtract a binary one from that directed broadcast address. And that’s what it looks like in binary.

Let’s convert it to decimal, and it’s going to be 172, 25, 0, 254. That means our usable range of addresses for 172 25 dotzero zero, dot, is going to be in the range of 172 250 one all the way through 172 250 254. In our next subnet, which we determined by counting by the block size in the interesting octet, we added a one to the third octet. We know the subnet is 107.225.1024; we can do the very same math here to determine the useful range of IP addresses for that subnet. But here’s a bit of a shortcut for you, since we’ve already determined the directed broadcast address for that first subnet, 172 250 zero. What if we counted by the block size in the interesting octet for the directed broadcast address? Yeah, that’s going to give us the directed broadcast address for the remaining subnets. And once we know the subnet address, or in other words, the network address and the directed broadcast address, everything in between is within our usable range of IP addresses. And that’s a look at how to calculate usable IP version 4 address ranges when we extend the default subnet mask.

14. 9.13 Subnetting Practice Exercise #3

I’ve got a challenge for you. In this video, I want you to calculate how many subnets get created when we add some bits to a default subnet mask. And I want you to tell me what the usable address ranges are for each of those subnets that get created. Specifically, here’s the scenario I’ve got for you: You’re going to be applying a 26-bit subnetmask to a class C network at dot zero.We know that a class C network has a default subnet mask of 24 bits. In other words, you’re going to be adding two bits to the default mask. The question I have for you is: what subnets get created? And as part two of that question, within each of those subnets, what are the usable IP address ranges that we have? In other words, what IP addresses within each subnet are valid for assigning to hosts? You might want to pause the video now and resume when you’re ready to go through the solution.

All right, let’s go through the solution together to determine the subnets that we create. First, we identify the intriguing octet. The interesting octet is the last octet to contain a binary one in the subnet mask. While our subnet mask looks like this, this is a 26-subnet mask. 255. 255. Got 255. 192.That means we have two ones and six zeros in that fourth octet. That tells us the last octet to contain a binary one is that fourth octet. It contains a couple of binary ones. Next, we determine the block size. And the block size is 256 minus whatever the subnet mask value is in the interesting octet. In our case, with a subnet mask of 255.255.255.192, With the fourth octet being the interesting octet, we’ve got a value of 192 in that octet. That means our block size is 256 bytes plus 192. That’s a 64. And to determine the first subnet, we’re going to use all of our borrowed bits. Those are the bits that we added on to the default subnet mask. In this case, it would be bits 25 and 26. We set those to zero, and we also set all of our host bits to zero. That’s going to give us a first-subnet network address of 192 1680.Calculate the remaining subnets. We’ll count by the block size in the interesting octet.

We’ll keep adding 64 in the fourth octet, and it’s going to give us these subnets. We’ve got 192. We stop there. Why don’t we add an additional 64? because that would put us at 256. That’s too big for an octet. 256 in binary is a one followed by eight zeros. That’s too big for an octet. So we have to stop there. The last valid value that we can ever have in an octet is 255. Those are our subnets. The next part of the challenge was to determine the usable IP address ranges in the subnets that got created. We know the subnets; we counted by 64 and the fourth octet, and we know that we have six host bits, and we set all of those to one with everything else being zero on that fourth octet. That’s going to give us a 63. That’s our directed broadcast address for the first subnet, 192. Our useful IP addresses are everything in between, from 192 all the way through 109, 216-8062.And as a shortcut to calculate the remaining directed broadcast addresses, we can count by the block size. In the interesting octet, we add 64 in the fourth octet to 63. That gives us 127. Add 64 to that total of 191. To that 255, add 64. That is an easy way to come up with our directed broadcast addresses. And we know that the usable IP address range for those subnets includes everything in between.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!