From the course: Cisco Certified Support Technician (CCST) Networking Cert Prep

The need for subnetting

(bright music) - [Instructor] We know that our different classes of IP addresses in the class A, class B, and class C ranges, we know that they 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. For example, let's take a class C network of 192.0.2.0/24. And imagine we're trying to interconnect a couple of sites. We've got router R1 at one of our locations. We've got router R2 at another location. And this link between the sites, it only needs two IP addresses, doesn't it? We could give R1 the IP address of 192.0.2.1, and R2 could have the IP address of 192.0.2.2. So what do we do with all of those other addresses? It seems like we've wasted addresses in the range of 192.0.2.3 through 192.0.2.254. 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, it's 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 a slash 16, it's going to give us over 65,000 assignable IP addresses. But a class C network that we're using here, it's 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 we can break it up into different subnets, different network address spaces or different VLANs. And to get from one subnet to another subnet, we have to route. But this is a way that we could separate our departments in 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 on their local network to see what printers are available, they don't want to see one another's resources, so we want to separate them. We could also do that for security reasons, so we could 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 to keep in our IP writing table, it could get a bit overwhelming. For example, the internet currently at the time of this recording has a little over 800,000 networks in its network writing table. That's a lot. One thing we could do is take similar networks with a lot of bits in common, and we could summarize those with a single advertisement. Take these four networks just as an example, and 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, 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 bit are all identical. If we added up eight plus eight plus three, the first 19 bits are the same for all of these networks. So what if we said these 19 bits that are all the same, let's advertise that as our network. We'll say those are our network bits and the remaining 13 bits, yeah, 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 their corresponding decimal value, we've got 255, got 255. And what is 111 followed by five zeros? That's going to be a 224. That's 128 plus 64 plus 32, that's 224. And a network address is where we have all of our host bits set to zero. So in this case, in the first octet, we've got eight bits and they are 11 followed by six zeros. Then we've got a 10101000, 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.168.0.0. That's the network address. We could advertise 192.168.0.0/19. And if somebody wanted to get to an IP address in any of these four networks, they could go wherever that route said to go when we advertise that route of 192.168.0.0/19, because that encompasses all four of those 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 every device within this network of 192.168.0.0/19, I can go to that network's directed broadcast address. That's where we have all of the host bits set to a 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. And for the directed broadcast, all the host bits are one. So in that third octet, we've got five ones, that's going to be 16 plus eight plus four plus two plus one. If you add all that up, that's 31. And let's 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, and 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.

Contents