Juniper JNCIA-Junos JN0-104 – Section 1: Networking Basics Part 4
April 16, 2023

10. Subnetting Example 1

It’s now time to do some subnetting. Make sure you have a pen and a paper handy as we’ll be doing some live examples.

Subnetting is the process of taking a large network and breaking it down into smaller networks, also known as subnets.

Let’s first understand the steps for subnetting. So, we have four steps that we need to keep in mind. Step number one is to convert the subnet mask into binary format. On step number two, we need to determine the number of host bits that need to be borrowed. Step number three is to determine the increment. And step number four is to add the increment to get the new subnets. Don’t worry. If this does not make any sense to you right now, when you look at the examples, it will become absolutely clear.

So let’s start with the first example. Divide 192.168.1.0/24 into 5 networks. So, we have one network, which is 192.168.1.0/24. We need to break it down into 5 networks.

The first step is to convert the separate mask into binary format. So, the decimal format is /24 which is 255.255.255.0. And when we convert this to binary, the first 24 bits would be all ones. That’s what /24 means. And the last eight bits would be all zeros.

So that’s the first step. We just need to convert the subnet mask into binary format.

Step number two is to determine the number of host bits to be borrowed. The first question is why do we need to borrow bits? Well, the original network that we have been given is 192.168.1.0/24. And we need to break this down into five networks. So, with 24 network bits, we have one network. If we want to increase the number of networks to 5, that means we need more network bits. But we already have the first 24 bits fixed. It’s the last eight bits, the last eight zeros that we can borrow from to get more networks.

Remember, if you want more networks, you need more network bits. The bits that are already ones, we can change them, but the bits that are zeros, we can change them to ones. And that way we can get more networks.

So, 192.168.1.0/24 is one network. This needs to be broken down into 5 networks. If we need more networks, we need more network bits. We need to borrow from the host bits and convert them into network bits.

So that’s step number two, didn’t mind the number of host bits that need to be borrowed.

Now, there is a way to compute this. The number of bits to be borrowed can be deteremined using this formula to 2X is greater than or equal to the required number of subnets. In this case, the required number of subnets is 5. So, when we substitute that to 2X is greater than or equal to 5. We need to find that value of X that will satisfy this equation. If we start with X equals 0, 25 would be 1 that is not greater than or equal to 5. If you substitute X equals 1, 21 one is 2. That does not satisfy that equation. When X is equal to two, 22 is 4. That is not greater than or equal to 5. When we substitute X equal to 3, we get 23 which is 8. And that is definitely greater than or equal to 5. That is the number of bits that we need to borrow. We need to borrow three host bits and convert them into network bits.

So, the original subnet mask is /24. So, we have 24 ones followed by eight zeros. Now we’re going to borrow three host bits. So, the new subnet mask will be /27. And this is how the new subnet mask will look like. First, 24 bits remain unchanged. But from the last eight host bits, we’ve borrowed three bits and converted them into network bits. So, the original subnet mask was /24 = 255.255.255.0. The new subnet mask is /27 = 11111111.11111111.11111111.11100000.

Now, we need to get the decimal format for this. The way to do that is just take the last octet. Which is 11100000 and align them with the powers of two. We spoke about this in one of the earlier videos. We understood how to convert binary to decimal. So, you align the binary bits with the powers of two, starting from the left to the right. So, we start with 20. And we go all the way up to 27. And then we write the powers of two only for the bits that correspond to the ones. So, 27 is 128, 26 is 64, 25 is 32, and we ignore the rest because they are all zeros. We only take the powers of two that correspond to the ones. And the last step is to add them. So /27 is 255.255.255.224. The way we get that is by adding 128+64+ 32.

So, this was our original subnet mask. When we break it down into smaller networks, the new subnet mask will be /27 which is 255.255.255.224. So that is step number two.

Now let’s go to step number three. On step number three, we need to remind the increment. The increment is the power of two corresponding to the least significant bit. We know that the new subnet mask is /27 and the last octet looks like this. We have three ones followed by five zeros. And these are the powers of two corresponding to ones. So, the first power of two on the left is 128. The second power of two is 64 and the third power of two is 32. The least significant bit will be the rightmost bit. We ignore the zeros. We only consider the ones. The least significant bit is the rightmost bit. And that is going to be our increment. So, the power of two corresponding to the least significant bit is 32. And that is our increment.

Now we are on the last step, step number four – add increment to get new subnets. So, we know the first network address that is 192.168.1.0. We need to add the increment. But where do we add it? Do we add it to 192? Do we add it to 168? Do we add it to 1? Or do we add it to 0? The increment should be added to the octet from which bits were borrowed. In this case, we borrowed bits from the fourth octet.

So, step number four – add increment to get new subnets. So, when we add 32, our increment, to the first address 192.168.1.0, this is what we get. So, we start with 192.168.1.0. We add 32 to the last octet. We get 192.168.1.32. And we keep repeating this. So, we get .64, .96, .128, .160, .192, .224. And what is the subnet mask for these networks? Well, the new subnet mask which is /27.

So what we’ve done here is we’ve taken one network which is 192.168.1.0 and we’ve broken it down into 8 networks. We need it 5. But we got 8. Keep in mind, the number of networks will always be a power of two. So, you can always break it down as 2, 4, 8, 16 and so on.

But we’ve got the required number of networks we need 5. We have 5. And plus we also have three more which can be used for future purposes.

So, keep in mind, the four steps for subnetting in the upcoming videos will look at some more examples.

11. Subnetting Example 2

All right, let’s look at one more subnetting example. This time we are going to use a Class B IP address. So, the task is to divide 172.10.0 0/16 into 10 subnets. I hope you, guys, remember the four steps.

Let’s start with step number one, which is to convert the separate mask into binary format. So, in decimal format, it’s a /16, which can also be written as 255.255.0.0. And in binary format, that would be ones for the first 16 bits and zeros for the last 16 bits.

Step number two is to determine the number of host bits to be borrowed. We have a formula to do that. The number of bids to be borrowed can be determined using the formula 2X is greater than or equal to the required number of subnets.

In this case, we need 10 subnets, so 2X is greater than or equal to 10. When X is equal to 1, the value would be 21 equals 2. When X is equal to two, 22 is 4. When X is equal to 3, 23 is 8. When X is equal to 4, you will get the value as 16, which is definitely greater than or equal to 10. So, the total number of bits to borrow equals 4.

So, the original subnet mask was a /16. And after borrowing 4 host bits, the new subnet mask is /20. And it looks like this: /20=11111111.11111111.11110000.00000000.

Now, a couple of things to note over here. Number one. We haven’t borrowed from the last octet. And from the third octet, we’ve used the first 4 bits, not the last 4 bits. There’s a reason for this. Your network bits have to be contiguous, which is why we are not using the last 4 bits of the third octet, and which is also why we are not using the fourth octet. The network bits have to be contiguous.

Now we need to convert this to decimal format. So /16 is 255.255.0.0. And here we have /20. Now we need to determine the decimal equivalent of the third octet. We know how to do this. So, we write the bits first and then we write the powers of two starting from left to right. So, in this case, the powers of two are 128, 64, 32 and 16. We ignore the rest because they correspond to zeros. And finally we add them up, which becomes 255.255.240.0. That is our new subnet mask.

Let’s go to step number three. Step number three is to remind the increment. And we know that the increment is the power of two corresponding to the least significant bit. We know that the new subnet mask is /20. And this is the third octet of that subnet mask. The least significant bit is the rightmost bit. So in this case, the power of two corresponding to the least significant bit is 16. And that is going to be our increment.

Let’s now go to the fourth step – add the increment to get the new subnets. The increment should be added to the octet from where we bought the bits. In this case, the third octet. So, when we add 16 to the third octet, these are the networks that we’ll get. We start with 172.10.0 0. And we add 16 to the third octet. So the next network is 172.10.16.0. The next 172.10.32 0. And we keep adding that way until we reach 172.10.240.0.

At this point, if we add 16, the third octet would be 256. We know that’s not possible because the highest possible value for an octet is 255. So that’s the last possible network, 172.10.240 0.

All these networks will have the new subnet mask of /20. So, the requirement was to get 10 subnets. We’ve got 16 subnets because the number of subnets will always be a power of two. I’ve got some exercises for you to practice on your own. The first one is divide to 223.0.0.0/24 into 2 subnets and the next one – divide 130.8.0.0/16 into 7 subnets.

12. Subnetting Example 3

All right, let’s look at the next example. This time we’re going to use a Class A address and we’re going to give it a bit of a spin. So here’s the task. We need to divide 124.0.0.0/8 such that each network has 500 hosts.

Now, this is a bit different from the way we’ve done the previous examples. In the previous examples, we had to subnet in a way where we get a certain number of networks as a result of the subnetting. Now, we need to subnet in a way that each network that we break it down into will have 500 hosts. The process will remain pretty much the same.

Let’s start with step number one, which is to convert the subnet mask into binary format. So, the decimal format is /8, which is 255.0.0.0. And when we convert that to binary, we have the first eight bits made up of ones and the last 24 bits made up of zeros.

Let’s now go to step number two. But this time there is a bit of a change here. Now we need to determine the number of host bits that need to be fixed. Why? Because we need to get a certain number of hosts in every network. The host bits need to be fixed so that we will ensure that every network will have that many hosts.

So, instead of borrowing host bits to convert them into network bits, will first fix the host bits that will remain unchanged. The formula for doing that is pretty much the same as the previous formula – 2X is greater than or equal to the required number of hosts. And we also need to add the value 2 because in every network, the first address and the last address cannot be assigned to a host. The first address is the network address and the last address is the broadcast address. So, we need to consider that. That’s why we are saying 2X is greater than or equal to the required number of hosts plus 2. In this case, 500+2. So, we need to find the value of X that will satisfy this equation. So X is equal to one, two, three, four, five, six, seven and eight will not satisfy this equation. So as you start with X is equal to one, two, three and so on, you will reach X is equal to nine. That will satisfy this equation. When X is equal to 9, 29 is 512. And that is greater than or equal to 500. So, the total number of host bits that need to be fixed is equal to 9.

So let’s go back to the original subnet mask, which was /8. Now we need to fix 9 host bits. That means we are left with twenty-three bits for network. And the new subnet mask will look like this. Remember, the network bits and the host bits have to be contiguous. Which is why we’ve fixed the last 9 bits. So we’ve set the last nine bits as zeros and we’ve converted all the remaining bits as ones. That way we are sure to have that many hosts on each network.

So, this is pretty much same as the previous examples that we looked at. In the previous examples, we used to set the network bits. In this example, we are setting the host bits.

Now we need to convert the subnet mask back to decimal. So /8 is 255.0.0.0. /23 is represented over here. We’re going to take the third octet because that’s where the change occurs. The third octet. And write it with the powers of two. So, the powers of two that we’re interested in are 128, 64, 32, 16, 8, 4 and 2. We’ll ignore the last one because that corresponds to a 0. And we need to add all of them. So the new subnet mask, which is /23, can also be written as 255.255.254.0.

Step number three is to remind the increment. The increment is the power of two corresponding to the least significant bit. In this case, the change occurs in the third octet, so we’ll line it up with the powers of two and the least significant bit is the rightmost bit and the power of two corresponding to that is 2. So that is going to be our increment.

Now we’re going to the last step, which is to add the increment to get the new subnets. So, we’ll start with the first network, which is 124.0.0.0. And we need to add increment to the third octet. So, we get 124.0.2.0, 124.0.4.0 and so on. And as you keep adding, you’ll reach 124.0.254.0. Now, if you add 2 here, you will get 256. We know that the highest possible value 255. So, when you try to add 2 over here, you can’t do that. So, you have to carry forward to the next octet. So, that becomes 124.0.0.0.

Similarly, you’ll keep adding, you will reach 124.1.2.0, 124.1.4.0, all the way up to 124.1.254.0. And then you will go into the next one, which will be 124.2.0.0 and so on until you reach a point like this – 124.254.0.0. We’ll start adding 2 again to the third octet, so that’s 124.254.2.0. You keep adding to the third octet. In the end, you will reach a point 124.254.254.0.

Now, if you try to add 2 to the third octet, that becomes 256. We can’t do that, so we have to carry forward to the second octet, which will also make it 256. So, you would have to carry forward to the first octet. That will take you to a whole different network, which is 125. So, we can’t do that. So, that is your last possible network.

All of these networks that we’ve computed here will have the subnet mask of /23. The total number of possible subnets will be 2N, or 2 power the number of network bits that were borrowed. In this case, fifteen. We started with /8 and then we added fifteen bits to reach a /23. So, the total number of possible subnets will be 215. So, we 32768 possible subnets.

The total number of hosts per subnet will be 2H, or two power the number of host bits, which is to 29, which is 512. But we know that the first address is the network address. The last address is the broadcast address. And both of these cannot be assigned to hosts. So, the total usable hosts per subnet is 2H – 2, which is 512-2, which equals 510.

Our original requirement was to divide in a way that we have 500 hosts per network. We have divided in a way that we now have 510 hosts for network, which is definitely satisfying the requirement.

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!