Next, we need to take a look at classful vs classless, or CIDR addressing. Some of the characteristics of classful addressing or classful routing are going to be things like, all subnetworks, or subnetted networks, will have the same interval. Meaning that if I were to take a network and chop it up into pieces, each piece will be the same size, or they would have the same range, or what we call the interval. So all subnets are contiguous and, therefore, have the same subnet mask. If a Class B network then is divided into 8 networks, as I said, all 8 subnets, all 8 subnetworks will have the same subnet mask. In this case, it would be 224. So you'd see 224 in the third octet of the subnet mask. Default Class B network subnet mask is going to be 255.255.0.0. But since we need 8 more subnets, we're going to have to borrow some of the host bits, turn them into network bits to create these networks. And that's really the process of subnetting. Subnetting is the process whereby I take some of the zeros that I have in the host portion of the address and turn them into ones, and then change the subnet mask to accommodate that number of networks. In classless routing, or CIDR, all subnetted networks can have different intervals. Meaning that on one side of a router I could have a certain subnet mask, on another side of a router it would be different, okay? So all subnets don't need to be contiguous. So, for example, a network, you could have a /16 on one side of a router with a /19 on the other side of the router. In other words, there are no classes. All subnets are represented by a forward slash and so many number of bits, or x number of bits, to represent the network portion of the IP address. Another way to look at this is that classful uses a fixed subnet mask with a fixed contiguous number of bits in the network portion of the address. Where with classless, you determine how many bits you want to use for the network portion of the address. So we're looking at going back and forth here again, the difference between classful and classless. Classful, when we say classes we're saying class A, B, and C, and we'll look at a table of that in just a moment here. Well, classful routing protocols that build routing tables do not send their subnet mask information with the routing updates. So a router running a classful routing protocol will do one of two things when it receives a route. If the router has a directly connected interface belonging to the same major network, it's going to apply the same subnet mask as that interface. If the router does not have any interfaces belonging to the same major network, it will apply the classful subnet mask to the route. Meaning a default A, a default B, or a default C mask. Default A being 255.0.0.0. Class B, we have 255.255.0.0. And then Class C having three 255s, or 255.255.255.0. Some examples of classful routing protocols are going to be RIP version one and IGRP. So when we say belonging to the same major network, this simply indicates that they belong to the same classful network. For example, if I have 10.1.1.0 and 10.2.2.0, they belong to the same major network. That would be the 10 network, the 10.0.0.0 network. Because their default subnet mask would be 255.0.0.o, and so they would be both on the 10 network. However, 10.1.2.3 and 11.1.2.3 do not belong to the same major network. Let's take a look at now some classful address ranges. Here we can see in this table that we have five different classes of address, A, B, C, D, and E. What has been used in the past is A, B, and C. As far as I know, most of the classful ranges are pretty much gone, if not completely gone. D and E, D is going to be a multicast range, and E is going to be experimental. If you look at the Class A address, you're going to know it's a Class A address because in the first octet, if it's between 1 and 126, 127 is loop back, that's a Class A address. Here you can see, looking at the top row going across next to A, it says the first octet bits, the blue bits, here they don't change. So for a Class A address, it's always going to start off with 0 something. And then the next seven bits are going to represent the rest of the network. And then the last 24 bits, in black, if you look to the far right, are going to be the host portion of the address. So if you were to create a number such as 50, which is between 1 and 126, 50 is always going to have the first bit as 0. because the first bit is your 128th vector number. The second bit is the 64 bit. And so that's why between 1 and 126, the first bit is always 0. The next column there you can see again, just a simple representation between N, network, in blue, and H, host bits, in black. And then we see the default subnet mask, 255.0.0.0. We see the binary representation of the default subnet mask. And then we can see going to Class B, in Class B, it's going to be 128 to 191. And so in the next column there, you see 10, the Class B address always starts off with 10 because that first bit is 128. The next one's going to be 0. Because if we're going to go up to 191, it's going to look like 10 and all 1's. Then we move over and we can see then that our network portion in blue is two octets, represented by the default subnet mask of 255.255.0.0. And then we see the binary representation, and so on. Class C is always going to start of as 110 because 110 is going to give us numbers between 192 and 223, and so on and so forth. And you can see the same pattern is true for both D and E networks. So why are we starting off with classful addressing rather than classless? Mostly because it's a little bit easier to teach subnetting. Because we're starting from the premise that if I have a default class address, like a Class B, I know that my starting point is 16 bits. Notice they're in blue. We have eight bits dot eight bits. So the process of subnetting is borrowing host bits' 0's to create networks and turning them in to 1's. If we borrow host bits, then the number of host bits we borrow is used to mathematically figure out how many networks we want to create. It's based on 2 to the n. So there's a tradeoff. The more host bits we borrow, the more networks we create. So as we borrow host bits or 0's moving to the right, we double in binary the number of networks, or 1's we can create, while cutting in half the number of hosts per subnet that are left. I mean, just look at it mathematically, if you look at the bottom example there, 255.255.240, we have borrowed four bits in that third octet. Well, if we borrow 4 bits and double moving to the right, because it's based 2, and that's 4 less 0's we have for host represented by the green 0's. If we go to the other direction and we wanted more host, we could take the 1's and turn them to host that would mathematically the same process jut in reverse. I will double the number of host while cutting the number of networks in half. But again that's not really what we're trying to do here, we're trying to take a large network and divide it into smaller subnets. And again we do that by taking this 0's in green, and turning them in to 1's. And again the number of 0's I turn in to 1's determines the number of networks I can create. Now I know that this might look a little busy, so let's go ahead and break it down a bit. At the top of the diagram here, we can see our patterns of bits, turned on 8 bits, and their placeholder values, the 1's place, 2's place, 4's place, 8's place, 16's place, 32, 64, 128, that's going to help us calculate our subnet mask. Now there's really 5 questions if you look in the bottom left that you need to answer in order to do subnetting. And as we're going through this we're going to go through each one, one at a time, you're going to see highlighted across the top each question being answered or addressed. So question number 1 then is, what is the default class that we're starting off with? In other words, is it the class A network that we want to trap up a class B network, a class C network? And so the next question is, how many subnets do we require from, let's just say, a class B network? If we want to create four networks, we need to borrow 2 bits. Why is that? Remember, 2 to the n, that's going to be our process for figuring how many networks we want. We know that 2 to the 2, 2 bits borrowed, is 4, that gives me 4 combinations of 0's and 1's, for example, 00, 01, 10, and 11. Those are the only four combinations that we get out of 2 bits. And so when I borrow 2 bits the next thing here to create my 4 networks, as result of that those 2 bits are 128 plus 64 which equals my subnet mask, that is 192. Again if you're going from left to the right, you can add up 128 and 64 and that's what you're going to get. Now in parenthesis there I have a little i for interval, now notice there that there is a relationship mathematically between the mask and the interval. The interval, also called the range, dictates the size or number of hosts that I'm going to have in each of my networks. If you look to the left in the blocked in area, looks like a little legend there, you see where it says 256 minus the mask gives me the interval. Remember that 256 is the total number of combinations we get with 8 bits. You're thinking what I thought it was 255, well, it's 0 through 255 gives me a 256 combinations. If I subtract the mask from that, that gives me the size of my range, if you go down this column number 4, you can see that 192 plus 64 is 256. 224 plus 32 is 256, 240 plus 16 is 256, and so on all the way down. So the blue and the purple numbers added together always give me 256, so again this relates to the last slide. Mathematically, as I'm borrowing 0's and turning them into 1's, I'm creating more networks, but the size of those networks gets smaller. I mean, I only have so many bits mathematical to play with. If I borrow 8 bits to create 256 networks, my mask is going to be 255 and my interval's going to be 1. Which is in many cases, not used specifically for talking about the class C network. All right so, I have determined that I want four networks and that I've had to borrow 2 bits to create 4 networks. And that 2 bits added up together, starting from the left is 120 plus 64, it gives me 192. And that will leave me with so many hosts per network, which is the last question or the last thing we would need to address. And so for example, if 2 to the n represents the number of networks, in this case 4 that I want, and I needed two bits in order to create that, that gives me a masks of 192. The number of hosts actually 2 to the n- 2, and the reason for that is that we still get 64 combinations with 2 to the n. The reason we subtract 2 is because the first address in the range is going to be 0. And we will throw out the last address as well which should be a 1s which should be a broadcast on that subnetwork. So, we always throw out the first address which is 0, it just indicates this network only, and we throw out the last address which is 255 which is a broadcast. And that's basically how we go through and do subnetting. Now over time you can look at your subnet mask and if you're troubleshooting and you see 240, in your head you can say, well, my host should be within intervals on multiples of 16 of each other. In other words, 0 through 15 would be one range, 16 through 31 would be the second range. And if hosts were too far away from each other, they must be on a separate subnetwork. So again, real quick in down and dirty way to do this is just take 256 minus the mask gives me the interval 256 minus the interval gets me the mask, and again, I can see those ranges very clearly. Now what we want to do is kind of work a few problems, the first single due is try to calculate some subnets and hosts for Class C network. And as you can see, I did the first one for you there, so once we do that, we can go in across, I didn't number the columns here, but it's the same process. The steps are the ones we know what the class of address we have, what is the number of subnets required. And the first example at 6, how many bits do we need to borrow to create those subnets and I put 3. Actually 3 bits will give me 8 combinations but it doesn't say I need 8, I need 6. So, if for some reason the number isn't exact, I have to go to the next highest multiple. So, if it said number of subnets required is 9, I have to go up to the next highest number on my subnet chart and I would have to borrow 4 bits. And now I just have some extra subnets left over. But in his case here, the 3 bits that I used in order to create my 6 networks results in a subnet mask of 224. Which is going to be 128 plus 64 plus 32 and that will give me 224. The number of host that I have left, though, if you look in your table would be 30. So it'll be 32, it'll be 2 to the end minus 2 again throughout the 0 and throughout the 0 and throughout the 1 address. And that will give me 30 hosts for each of those 3 subnets. Notice we're all the way down into a classy network, so we only have 8 bits to play with. And so if I use 3 of those bits to create subnetworks, that only leaves me 5 left over in order to create hosts. Now why don't you pause the audio for a moment and go ahead and fill the rest of the table. [MUSIC] Okay, this is what you should have gotten here. If you wanted to create 42 subnetworks, you would have to borrow 6 bits. The result in subnet mask in the last octet would be 252, and it would give you 2 hosts per subnet, not much. So again, you borrowed at 6, you only have 2 bits left, which is 4 combinations, subtracting 0's and 1's gives you two hosts. And then again, as you're going down through the rest of the table there, you can see that, if you wanted 11 subnets, again, you'd have to move to the next highest level. You'd have to borrow 4 bits in order to create that many networks. It's going to give you a subnet mask of 240, with 14 hosts. And then 29, again, 29 is not an even multiple, so I would have to go up to the next highest number, and I would have to borrow 5 bits in order to create that number of subnets. 5 bits contiguously is 248 in the subnet mask, and that only leaves me 3 bits, or 8 combinations, minus 0's and 1's, to give me 6 hosts per subnet. Let's take a look now at calculating subnets and hosts for a Class B network. Here you can see, that in the column on the left Start over. Now we're going to take a look at calculating subnets and hosts for a Class B network. Again, we have the same steps. You can see in the left column it says required number of subnets is 12. In order to get 12 subnets, we're going to have to borrow 4 bits. Borrowing 4 bits will actually give us 16 networks, 4 combinations. Start over one more time. Next we're going to go ahead and calculate subnets and hosts for a Class B network. As you can see, the steps are the same. In the column on the left, it says number of subnets required is 12. In order to get 12 subnets, we have to borrow 4 bits, that will actually give us 16 combinations. And 4 bits contiguously, in the subnet mask, would move the default Subnet Mask from 255.255.0.0 to 255.255.240.0. 240 again, being the 128 bit, plus the 64, plus the 32, plus the 16, equals 240. And this is going to give us, why 4,094 hosts? Well, because remember, it's not just the 0's in the last octet, because at 240, remember, is four 1's and four 0's. So its actually four 0's in the third octet, and eight more 0's in the last octet for a total of 12 0's. And mathematically, if you go from the right to the left and double, in binary, 12 times, you will get 4,094 combinations. Now take a moment, and go ahead, and fill out the rest of the table. [MUSIC] All right, is this what you got? because this is what you should have gotten. Here you can see again Again, you can go ahead and look at that and do the math on this. But if you were to get or need 99 subnets, you're going to have to borrow 7 bits, and that's actually going to give you 128 combinations. Again, my resultant subnet mask for that is going to be 255.255.128.0. We're going to have the 9 bits left over. The 128 is, again, one bit shy of being full octet. So you're going to have seven 1's and a 0 in the third octet, and then another eight 0's in the last octet. So you'll have nine 0's, which is going to give us 512 hosts per subnet, minus 0's and 1's, which is 510. And if you look at the rest of these, again mathematically, it's just a matter of figuring out how many subnets do you need, how many bits do you need to borrow in order to create that number, the resulting subnet mask from having that many bits changed in a row in that particular octet, and the resultant number of hosts per subnet as a result of that. Lastly, we want to go ahead and calculate subnets and hosts for a Class A network. And again, as you see, there are five steps, or five questions, or things to be addressed. And here we have, in the left hand column, number of subnets required as 100, 200, 1,500, and 4,000. So if we want 100 subnets, we actually can do that by borrowing 7 bits, which will give me 128 combinations. 7 bits continuously gives me a subnet mask of 128, and what that does then is that gives me a lot of bits left over. It gives me the eighth bit in the second octet, because we're borrowing 7, and then 16 more bits, or 16 more 0's, for a total of 17, and that gives me a total number of 131,070 hosts per subnet. So again, if you have a class A network, you could divide it up in to 100 subnets. Each of those 100 subnets would have 131,000 hosts in them. Once again, we have a lot of host bits that we can borrow. Okay, go ahead, and take a moment, and go through and fill out the rest of the table. [MUSIC] As you can see, going from 100 to 200 just involved borrowing one more bit, and we went from 128 to 255. But notice, again, this is a good illustration of borrowing one more bit in order to create twice as many networks. But notice in the right hand column, my 131,000 now got divided in half because we moved 1 bit further to the right, so that gave us one less host bit. So again, divided that in half. When we move from 200 to 1,500 of subnets, I have to actually borrow two more bits or my resultant subnet mask, in this case, goes to 255.255.192.0. And again, notice the relationship there on the number of hosts. The last one here is 4,000 subnets that are required. And for this we would borrow two more bits, going from 10 to 12. Notice my subnet mask now is all the way down into the last octet, and notice how many host per subnet are leftover as a result of that, not many, just 14. So you can kind of see that trade off there, as I borrow more bits to the right, and and my mask begins to move to the right, taking up 0's and turning them into 1's, I actually get less host per subnet.