Hi and welcome to this CertificationKits CCNA training video on subnetting. Subnetting is one those things that people try to avoid, but we’re going to try to make it as painless as possible. We’re going to talk about why we subnet, subnetting in binary and breaking the IP address down in binary. It's a pain, but it works and you can see what's going on with the numbers and then we’re going to do a few CCNA type practice questions. We’re also going to talk about CIDR and supernetting. What that is, variable length subnet masks and how we implement that on our network. And, there’s also a couple of references I want to point out; learntosubnet.com, it's a website, it has got a bunch of videos, it has got some practice questions for you as well as subnettingquestions.com. Subnettingquestions.com basically generates one random subnetting question after another for you to practice. So, once you’re done with this video you’re going to have to go in and practice, practice is what's going to get you to understand subnetting thoroughly and feel comfortable with it. This is a very important topic because understanding IP is allows you to understand the network more completely as well as understanding layer 1 cabling – IP addressing and subnetting is extremely important, so you’re going to have to practice once you get done with this video.
So, let's take a look at a sample network and why we might need the subnet. Now, subnetting allows us to take our network address; if we just have one network address 126.96.36.199, let's say we just had this one network address. We could only address one broadcast domain with this network address out of the box with the slash 8 subnet mask, also known as 255.0.0.0. Slash 8 simply means turn the first 8 bits on which gives us 255 all the other bits are off; so that’s our subnet mask. So, with this we can only address one broadcast domain. Let's take a look at why that is. I am going to draw in some computers over here and this subnet over here. This represents a subnet right here that sideways T, let’s say there’s a couple of computers right here. This guy’s IP address is 188.8.131.52, this is 184.108.40.206, the subnet mask they’re both using is 255.0.0.0. The way computers communicate with each other – let's say I want this machine right here to ping this machine. How they do that is when I type ping in in the IP address of 220.127.116.11 the computer compares the destination IP address to the subnet mask. And, what happens is he moves all the zeros — there’s this process called anding, and he gets what's called the network or subnet address. And, so when he does that for this 18.104.22.168 address he says okay, that’s network 22.214.171.124. He compares this network to his own and he does the same thing to himself and “oh, that’s network 126.96.36.199.”
So, in that situation when the destination node is on the same network, the machine sends out an ARP and says hey 188.8.131.52 I need your mac address and his mac address might be AB, he sends it back over hey, my mac address is a AB and then he takes the mac address, packages the information, puts the mac address on there and sends it out. If we didn’t subnet, so everybody was using a 12 address, this router might be in a completely different part of the world. We have a WAN connection here and he is in his subnet over here and we didn’t change anything and we give this guy an IP address of 184.108.40.206 and he wanted to communicate with 220.127.116.11 all the way over here. So, what's he going to do? We type in ping 18.104.22.168, this guy goes okay 22.214.171.124 let me compare that to the subnet mask 255.0.0.0 and he was okay that is network 12 and then it does the same thing for himself and he goes oh, I've got network 12 as well. So, what’s he going to do? He’s going to send out ARP so, the ARPs, ARP is a broadcast message and does not go beyond the router. ARP is destined for everyone in the same broadcast domain and it can't pass through the router. This guy over here never gets the ARP. So he’s never able to send his mac address back over. So, this guy cannot communicate because instead of trying to ARP this machine what he should be doing is ARPing his default gateway and sending the message to the default gateway to get there. But if this network is a network 12.0.0 and it’s not subnetted then the devices can't communicate. So, let’s look at actually having the network subnetted a little bit before we do some subnetting and show you how the process is going to work when it’s actually subnetted.
I’ll clean up the CCNA slide and now we’re going to look at those same two computers. This guy over here, this guy over here – they’re talking to each other and have a system all the way over in the corner here. Now, there are nine different broadcast domains in this scenario 1, 2, 3, did I say nine? I counted four additional routers instead of five over here. So, six routers altogether, 11 broadcast domains I can count very well here. Every connection, the router basically separates broadcast domains so on this side of the routers the broadcast domain between the routers is a shared broadcast domain and then the other side of the router here is another broadcast domain. So, what I can do is I can take this 126.96.36.199 address and I'm just going to use the different subnet mask 255.255.0.0 and I have subnetted this. I'm not going to go to process, so this one we’re going to go in more detail in a moment. But, basically what I've done is I've said this entire octet right here, one of these first 0 is also a part of the network address.
So, now we’ve got a bunch of different subnets over here is subnet 188.8.131.52 and what these guys are on is subnet 184.108.40.206, the new subnet masks is slash 16 instead of slash 8. So, let’s take a look at what happens now and this guy wants to communicate with this guy. Let’s say his IP address is 220.127.116.11 and this IP is 18.104.22.168 so, he does the same thing to communicate — I type and ping 22.214.171.124 and he was okay, 126.96.36.199, let me compare that to the subnet masks and he was okay, you’re subnet is 188.8.131.52 that’s the same subnet I'm on. So, what’s he going to do? ARP out. This guy replies to the ARP and gives his mac address and they can communicate. But what happens when this guy over here wants to ping 184.108.40.206? Now he’s going to go; I type in ping 220.127.116.11 and he does the comparison thing he goes okay 18.104.22.168 compares it with subnet mask and he goes, wow, you’re on subnet 22.214.171.124. My subnet is 126.96.36.199 that means I've got to go through my router to get there. So, that’s a big thing right there whether the router is going to help communicate locally or remotely. He recognizes that the subnet is not local to his. So, he’s on 12.1 and this guy is 12.10, the only thing he needs to do is ARP his gateway. So, instead of getting the mac address for this machine right here he’s going to get the mac address for his default gateway which might be A1 and he goes ARPs. He gets his gateways address, the gateway sends him his mac address and he sends the packet through the switch to the default gateway. The default gateway takes it from there and goes oh, I’ll send it over to this router and that router takes from there and sends it to this machine. So, it’s very important that we have subnetting to make more efficient use of our IP addresses as well as to allow the computers to communicate. If we didn’t have subnets, we would have to have a lot more network address to build the addresses of everyone of these individual broadcast domains. So, let’s take a look at the process of subnetting.
I have cleaned up the CCNA slide yet again. So now we’re going to take a look at the subnets. We’ve got one subnet there or one broadcast domain 3, 4 — let's see if I can get and right this time there is 11 of them 6, 7, 8, 9, 10 and 11. Now, we want to address it. We’re going to be using the 12 network address slash 8. Now, it’s important to know a couple of things. I’m going to jump back here real quick, it’s important to understand what class of IP address this it. This is a class A IP address.
So let’s take a look at a couple of these things before we going in and subnet this out. I have brought up the CCNA slide real quick of network class boundaries and this is just something that you have to know. If it’s a class A, class A network address defaults to a subnet mask of 255.0.0.0. So, what that means is, is there a limited number of class A address since only the first octet is part of the network address, and we know that because of this subnet mask right here. It’s very important to understand something that the subnet mask is a tool. It is a tool to allow us to tell where the network portion of an IP address ends and where the node portion of the IP address begins. It’s kind of like allowing the postal carrier to tell the difference between the Zip code and the street address. What this tool does and this tool can be manipulated, is it tells our computers like this tool right here tells the computers that hey, left side of this line is network address, right side of this line is nodeaddress. Since the class A networks have a 255.0.0.0, only the first octet is part of the network address and only numbers 1 through 126 are part of the network address. So we’ve got a 126 basically class A network addresses. 127 is reserved for loop back. If you ping 127.0.0.0.1, you get a reply, it tells you that TCP/IP protocols stack is installed appropriately on your system and tell you that physically your net is working and your cabling all that but it tells you that TP/CIP is installed appropriately on your system. So, if the number is between 1 and 126 we know that that is a class A address, if the numbers between 128 and 191 it’s a class B.
We’ll check out the subnet mask for a class B 255, 255. So, if we have class B we have got a bunch more combinations of 0s and 1s. First I have all the options in the 1st octet of 128 to 191. Then for each one of those options in the 1st octet I have got an option of 1 through 255 in the 2nd octet because the subnet mask says, hey, not only is the 1st octet part of the network address the 2nd octet is also part of the network address. Now, the class C has 255.255.255.0 that has three octets. There is 16,777,000 plus network addresses with class C because not only do you have 192 to 223 in the 1st octet you have got 1 through 255 combinations and another 1 through 255 combinations in the 2nd and 3rd octets. The only problem with the class C is you are more limited to the number of nodes per network. You’re limited to 1 through 254 and the node portion of the address gives you 254 node addresses because 255 is used for broadcast so you are more limited on the number of node addresses you get but there are a ton of class C network addresses out there. The last two 224 to 239 are for multicasting which is — a multicast is an IP or a broad– type of broadcasts not necessarily broadcast. A broadcast goes to everybody. A multicast goes to a group of nodes that are listening for a message on a particular multicast address. Like OSPF when a router sends out its OSPF updates it sends them to the multicast address of 188.8.131.52 and all the other routers are listening for for 184.108.40.206 to give example of a multicast address in use. Class E is used for research that’s 240 and above.
So those are basic class boundaries and you should be comfortable with this because that’s going to tell us something because if I have a 12 here and I'm using this subnetting mask that means I’ve got a whole bunch of subnets. I’ve got – I think it's 6500 plus subnets I’ve got here. If I'm using a class C network address like say 201 and I'm using the same subnet mask I don’t have any subnets because a class C uses the first 3 octets for network portion, class A only uses the first octet for network so that way when I use a class C address I get 2 octets of subnets. Class c address I don’t get any subnets out of this mask because this is the default mask that’s my starting point. So, it’s very important to be able to look at the first number in an address and be able to determine what class it’s a part of because that tells you what the starting point was for the subnet mask and how many potential subnets you have based on the new subnet mask.
Let’s go back to that subnetting that we were doing or actually going to subnet something. So, here we were – we were in a network with all the way up to 11 subnets. We’re using the network address 220.127.116.11. which is a class A which is slash 8 or 255.0.0.0 and what I am going to need to do with this subnet mask is I am going to need to change it because with the 12 the way it is, I can only address one of these broadcast domains. So what I have to do is I have to use some of this area over here to represent the sub portions of network 12. So basically like this whole thing right here is network 12, let me draw a big circle around it so this whole thing is network 12 and then we got sub areas of network 12, so sub area 1, 2, 3, 4 and so on. So we’re going to use our tool which is the subnet mask and manipulate it to allow enough combinations of 0s and 1s to represent these different 11 areas.
Let’s take a look at an example – I've brought up my CCNA slide here and I don’t need 9 subnets. I need 11 subnets so I’ve got network 18.104.22.168. I need 11 subnets now. Right now the subnet mask is right here and it tells the computer that the network portion is to the left of the line and the node portion is to the right of the line. So what I need to do is I need to take some of this area over here and mark it off as part of the subnet portion of the network. So, how do I do that? I change the subnet mask, now there is an equation that you can use 2 to the N minus 2 is greater than or equal to 11 is what we’re after. This is the number of subnets we need and I will explain the rest of this equation right now. Now, 2 to the N – what is tha?, All that is – is how many binary spaces does it take to get a certain number of combination of 0s and 1s. If I have one binary space I have a 0 or 1 possibility which is 2 combination of 0s and 1s that’s where these two comes from. The more 2s I have the more increases exponentially. Let’s take a look at that. If I have two binary spaces which is 2 times 2 0001 10 11 I get a total of one, two, three – four combinations of 0s and 1s which is 2 times 2. If I have 3 binary spaces that’s 2 times 2 times 2 which is 0000 001 010 011 100 101 110 and 111 that’s eight combination so you can see it works so every binary space I just multiply another two together.
So, what I have to figure out is how many binary spaces do I need to get eleven combinations of 0s and 1s because each different combination is a different subnet. Soall I do to figure this out is I go 2 times 2 is 4 that’s not a big enough number yet, times 2 is 8 not a big enough number, times 2 is 16 is that bigger than the eleven? Yes it is. So, it takes one, two, three, four binary spaces to get sixteen combinations of 0s and 1s. So, all that tells me to do is change my subnet mask one, two, three, four I add four more bits or turn on four more bits to the subnet mask and now this area is going to be the subnet portion of my address it’s that simple, all I have to do is multiply some 2s together until I get a number larger or equal to the number of needed subnets. Now, the minus 2 right here, we know the 2 is one binary space two combinations the N is a number of binary spaces so we have got 2 to the 4the minus 2 is in standard subnetting practice you don’t use all zeros (0) in this portion, you don’t use all zeros (0) here or all ones (1). However you technically can use all zeros (0) and all ones (1) but Cisco for the CCNA test does not like us to use all zeros and all ones so it's 2 to the 4 minus 2 so we are not going to use zeros subnet it's called or all ones and that gives us 14 valid subnets all together which is a bigger than 11 so we are okay.
I have cleaned up my CCNA slide again. And again we don’t need the 9 there. We need 11 subnets so we multiply 2s together 2 times 2 is 4 times 2 is 8 times 2 is sixteen. So, it's 2 to the 4 we need so 2 to the 4 minus 2 is equal to 14 so I need to add four more bits to my subnet mask so instead of slash 8 it becomes slash 12 also known as 255 and this is 128 plus 64 which is 192 plus 32 which is 224 plus 16 which is 240 240.0.0 so that’s our new subnet mask. Now all I have to do is figure out what my actual first subnet address is going to be and I do that by turning a bit on since I can't use all 0s there I have to make that a 1 that’s my first subnet address. So what is that first subnet address? It's 12. And this is 2 to the 0 is or 2 to the — anything to the 0 power is 1 and that's what this binary numbering system starts with, it's based 2 so this value right here in this space is 2 to the 0 which is 1. Then we go 2 to the 1 which is 2, 2 to the 2 which is 4, 2 to the 3 which is 8, 2 to the 4 which is 16 so this value if it's turned on is a value of 16 so you we’ve got 12.16 because that’s the only one that is turned on in this whole octet here. This octet is blank and this octet is blank so 22.214.171.124 is my first subnet and the subnet mask I am using is 255.240.0.0.
Once I have my first subnet all I have to do to figure out the next subnet is going increments to this number right here. So, I don’t even have to mess around with binary more all I have to do is to 12.16 is the first one so I now plus 16 126.96.36.199 is the next subnet and then another 16 188.8.131.52 whatever the first subnet number you get that’s the increments to subnets we’re going to go into because that’s your lowest value in the subnet portion and we can look at that if I wanted to in binary 0010 would be the next combination of 0s and 1s and that value is 32. So it’s 32 0 and then 1 1 – 32 plus 16 is 48 and then 1 0 0 which is the 64 value turn on 1 0 1, 16 added to that 80. Since 16 again is our lowest value here and we keep going back to this it goes from 0 to 1, 0 to 1 keeps turning off and on what it is — keep adding 16 every time and we can simply list out all our subnets. So let’s go in and fill in the slide real quick that has all our subnets on it and we’ll take a look how this turns out.
We bring up that CCNA slide so here we are and we have got 11 subnets we know 12.16 is the first one so we’re going and write subnets down here. Let me clean the CCNA slide up. So, I clean the slide up and we know there are 11 subnets. So all I have to do is start here 184.108.40.206 is the first one 220.127.116.11 is the second 12.48 and so on, I am just going to list the first 4 out 12.64 and then I‘ll do one more 12.80. So we have the subnets and all I have to do is assign the subnets to particular areas. Now, the only place that these subnet addresses actually exist is on paper because I don’t type in the subnet address in anywhere. But what I would do is if this over here was subnet 1; all of the machines in the subnet including the router interface right here would have an IP starting with 18.104.22.168 and would be the subnet. The IP would start with the 12.16 or more specifically the all IPs would start with this. Anything else after that is valid so 22.214.171.124 I could have 111 here; whatever but this would be the first 12 bits of all IPs in this subnet and then I would go this might be subnet 2. It is only two IPs that are going to in the subnet but the first 12 bits are going to be 12 start with that. That’s the first 12 bits and there is 8 bits here that make up this 12. So that’s – this is really on paperthe only place these numbers actually exist but when I type them in into the different areas along with the subnet mask the machines are able to resolve their IP with the subnet mask can come up with the subnet address. We need to know what IPs we can actually type in though so I have got 12.16 to subnet but what's the complete valid range of IPs for the subnet. Let’s go back to the IP slide and take a look at that.
All right, I have cleaned the CCNA slide up and now what we are looking at are the valid range of IPs for the 12.16 subnets. So here is 12.16, 12 this is the 16 value right here turned on, and here is the node portion of that address. So, all we have to do for the very first IP is turn this value on right here so all 0s and 1s the very first valid IP. We can't have all 0s in the node portion because that’s the actual network address and we can't have all 1s in the node portion because that’s a broadcast. So, our first valid IP is 12.16. — this octet is 0.0.1 the last valid IP put the subnets here at 126.96.36.199, next subnet is 188.8.131.52. Last valid IP would be all 1s and then a 0 in the last binary space so I am turningall these 1s on right here. What is that value? Well, it’s 12 and this is where a lot of people make a mistake they want to say 16 but that would only be half of the octet. This entire octet right here we have to add up so let’s get rid it of those, 16 plus 1, 2, 4 and 8 because we have these values right here. So it’s 16 plus those, what it comes out to, the biggest number I can get without hitting the next subnet, if I go 32 or more that’s in a different subnet 31 is the highest number I can go on that’s 16 plus 8 plus 4 plus 2 plus 1.
This next octet is 255.254 because it's all 1s then a 0s, so my valid range of IPs 12 16 01 to 12 31 255 254, let's go fill those in. So, if I want to all I have to do once I list out the subnets it's real easy I would go 16.0.1 biggest number I can get without hitting the next subnet, so the biggest number I can get change the color real quick, 31 is the highest I can go without hitting the next subnet and then 255.254. So I change– throw that in there and this 1s 32.0.1 the highest I can go is 47.255.254, and I like to work this in binary first until you get comfortable with the binary then these numbers will make sense 48 01 to 63.255.254 so anything within this range or IPs that I specified for the 12.48 subnet, 64 01 to 79.255.254 and for this last one would be 80.0.1 to 95 because 96 would be the next subnet 255 254, so this is the ranges of IPs. So, that’s subnetting with the binary.
Let's do a practice problem. So here is one practice problem that we’re going to go over. For each question we’re going to find each of the following. I only have one question, so it's not going to be too tough. So, for this one equation we’re going to find the new subnet mask, the total number of subnets provided we need minimum of 80. But how many are we going to get with this new mask? Because again more than likely we won’t get exactly 80. We’re going to list out the first four valid subnets and then the valid range of IPs for each one of those subnets. So I’ve got one 184.108.40.206. The first thing I do is I am going to break this thing into binary. So I don’t really need to break the 150 or the 50 into binary because I know that those numbers cannot change. I know those numbers can’t change because this is a class B network address, the class B default subnet mask is 255.255. So the first two octets are reserved for the network portion of the address. So if I were to change this 150 or 50, I would be using somebody else’s network address. And, then all I do is convert write out the 0s, kind of a pain but worth it. I don’t worry about filling 0s down here in the subnet mask because I am going to be adding some 1s to it instead of slash 16 it's going to be something else. So, now I just simply start multiplying 2s together until I get number larger than 80 4 8 times 2 is 16 times 2 is 32 times 2 is 64 – I am getting close, times 2 is 128. Okay how many binary space does it take to get a 128 combination to 0s and 1s – one, two, three, four, five, six – seven of them, so that tells me to do is going one, two, three, four, five, six, seven, at seven more bits to the subnet mask, the rest are going to be 0s so here is my subnet portion of the address.
Now, my new subnet mask is going to be slash 23 or 255.255. this is 254.0, and all I have to is list out my subnets, my very first subnet turn that bit on, what is that? I’ve got 150.50. and what is this value – this value is 1, this value is 2, so 2.0. Now, I know my subnets are going to go in increments of 2, so 220.127.116.11 150.50.8 — I am sorry 6 it's real easy for me to add 2s there .0 – okay I’ll get rid of that – and then 18.104.22.168. Don’t make that mistake, a lot of people — I see a lot of people and I just made it. You go 2 to 4 which is doubling 2 and then a lot of people double this number, it’s not doubling this number just keep going in increments of 2, 2 plus 2 is 4, 2 plus 2 is 6, 2 plus 2 is 8. Then, all I have to do is stay in between the lines here for these valid ranges of IPs. 2.1 the highest number I can go without hitting the nest subnet is 3 and then the last octet would be .254. So, the valid range of IPs here is 22.214.171.124 to 126.96.36.199 and anything in between is that as well, 4.1 to 188.8.131.52 and that’s for the 4 subnet. For the 6 subnet it’s 6.1 to 7.254. For this subnet the last one 8 subnet is 8.1 to 9.254 because 184.108.40.206 is the next subnet. And that’s subnetting, not too difficult but it does take a lot of practice.
I've brought up the slide on CIDR since we went over a subnetting problem. We’ve got to talk about what Classless Inter Domain Routing is. Classes Inter Domain Routing also known as Supernetting. All this is it’s kind of like the opposite of subnetting. It allows us to group multiple network addresses in the one network address to minimize the way in the routing table. So, what we could do is we could actually group these network addresses together so it cut down on the amount of routes in the routing table. So, we could group all these together to make them look like one network instead of four different networks or in some cases instead of a hundred plus different networks we can group them together. Now, the key with CIDR is we have to have, if we’re going to group these network addresses together, we have to have the appropriate network addresses to that. They have to be in succession and they have to start and stop with the certain particular address. So, they are going to be groups of 2s, group 2 to 4 8 you’re going to have to have the appropriate number of addresses and all I'm going to do is I'm going to make this look like one network address. I've 5, 5, 6, and 7 220.127.116.11.6 and 7 and all I have to do is change the subnet mask and what I do is I change it to the point where they all look the same. I've converted into binary here, 200 100 and then I converted the 4 binary, the 5, the 6, and the 7 and all I have to do is to super-net this and say okay at what point did they stop looking the same? They all look the same, they all look the same, they all have 1 in this spot right here, they all have 1s. They don’t all have the same values here.
So, what I do is I draw the line where they stop looking all the same. And then to the right at the line I need to make sure I own every different combination that’s possible for the 0s and 1s here I own 00 01 10 and 11 so that’s all the combinations, so I can super-net this and all I have to do to do this is change these values into a zero. So by grouping this together 200.100., this value is 4, 4.0 with a new subnet mask of 255.255.252.0 all those networks look the same or CIDR notation which would be 22 slash 22. This is called CIDR notation, but just because you see this I like to call it bitwise notation just because I see something like that doesn’t mean it’s CIDR, if I had a class A network address like 12 something like this and the slash 22 that’s not CIDR because that’s a subnet class A. CIDR is taking multiple network addresses and grouping them together like I did here and this is called CIDR notation, it’s also called bitwise notation. So, again all I have to do is line them up, dial the subnet mask back instead of moving it forward like we do in subnetting until they all look the same and make sure I have all the combinations of 0s and 1s possible and that supernetting also known as CIDR 18.104.22.168 and then this new subnet mask of 255 255 252.0.
Now, let’s take a look at what is called Variable Link Subnet Masks. We’re going to take the 12.80 subnet and break it down further, what might happen is you might have a subnet coming off of a router 22.214.171.124 you might need to break down even further in multiple additional subnets. So, let’s say we’re going to use VLANs and chop this one subnet up into 75 additional subnets. So, here’s our starting point, so what does happen is the rest of the network will be using a slash 12. this part of the network will be using something different. So, all we have to do is same thing with normal subnetting, figure out how many binary space we need to get 75 combinations of 0s and 1s and how I do that is I just start multiplying some 2s out and it takes seven additional 2s or seven binary spaces so I turn next 7 bits on. So, what that gives me is a new subnet mask, everywhere else in the networks using slash 12 here its slash 19. So, our new subnet is going to be something like this so it will be 12.80. this value is 32.0 is our first subnet, 12 80 64.0 this is going to go in increments of 32 here, 96 128 and I can keep going I just keep adding 32s eventually when I used up all these combinations it’d be 126.96.36.199 and it’ll go back and forth. So, this is Variable Length Subnet Masks and I use a different subnet mask in one subnet that I use in another subnet or throughout the rest of the network. Now, all routing protocols will support this, we’ll talk about that in the routing protocol section.
So, we have talked about subnetting, why we subnet, binary subnetting, we did a practice problem with that, CIDR also known supernetting and CIDR notation something like that, Variable Length Subnet Masks and again here’s a couple of references for some practice learntosubnet.com and subnettingquestions.com. I hope you have enjoyed this CertificationKits CCNA training video on subnetting and please remember to practice.