From the course: CompTIA Network+ (N10-009) Cert Prep
More CIDR subnetting practice
From the course: CompTIA Network+ (N10-009) Cert Prep
More CIDR subnetting practice
- So, I'm assuming you've watched the episode on CIDR, and you're here just to get a little bit more practice. Well, good for you. Now, before we get into this, I want to make sure you understand why this is taking place. Most people, if you look at their houses, when they connect to the internet, they just got some little router from Comcast or AT&T, or whoever your ISP is. Now, these addresses that are given to you by the ISP are what we call dynamic. They change from time to time, but I'm going to come up with more realistic scenarios for businesses. If you've got a web server, a game server, an email server, just about any kind of server that people need to get to, you need to have a fixed or static IP address. Now, we have an entire episode on dynamic versus static addresses, but for right now, we need to make sure that we understand how subnetting allows us to take static IP addresses and assign 'em to computers that need to be seen on the internet. So before we get into that, let me give you a particular scenario where we run into this all the time. Let's say, I'm starting up a little game server company and I'm just starting out, so I've only got four servers. And these servers all need real, honest-to-peak IP addresses from the internet. So I can't use just a little connection, like most folks use in their homes. I need to get what we call static IP addresses. I need my own network ID, and this is where CIDR really comes into play. Now, in this case, I only need four separate IP addresses. So CIDR does have some limitations. So what I want to do, first of all, is have you take a look at the subnet mask. If you remember, a WAC 24 always gives us 254 hosts. So what I want to do is march down through all the subnets from WAC 24 all the way down, and let's memorize the number of hosts you get for each one because it helps us determine how small of a CIDR subnet we need if you know the number of hosts that you need. So let's go ahead and march through the process. So what I have right here is a standard WAC 24 subnet. So I've got 24 ones followed by eight zeros. So we call it a WAC 24, and it has 254 addresses. A WAC 25 has 25 ones followed by seven zeros. So that's two to the seventh power, which is 128, but minus two, you can't have all zeros and all ones, and you get 126 hosts. A WAC 26 has 26 ones followed by six ones and zeros. So with just the six, it's two to the sixth power, which is 64 minus two is 62. A WAC 27 is going to be 27 ones followed by five zeros. Five zeros is two to the fifth, power minus two or 30 hosts. A WAC 28 subnet is 28 ones followed by four zeros. So two to the fourth power is 16 minus two is 14 hosts. With a WAC 29, we've got 29 ones followed by only three zeros, so two to the third power is eight minus two is we can only have six hosts with a WAC 29. A WAC 30 has 30 ones followed by two zeros which is two to the second power is four minus two is only two hosts. And a WAC 31 is 31 ones followed by one zero, so that's two to the first power equals two minus two equals zero. So we really can't do a WAC 31. It's really important that if you remember your subnet sizes, you could pretty much instantaneously know the number of hosts. So, I'm going to have to reference here, like for example, if I know I need four computers, only four static IP addresses, I'm probably going to go with a WAC 29, because that gives me six. The next one down only gives me two, and the next one up gives me 14. So it's not a perfect match, but it's a lot better than using classful addressing. So if you can remember your subnets, at least from WAC 24 down, that's going to help you quite a bit. Now, keep in mind, everything I'm doing here is WAC 24 down. However, I mean, we could do a WAC 10, a WAC 11, WAC 12, but go ahead and get started with this. Be comfortable with starting with a WAC 24 and subnetting it down, and that's a really good place to start. Now, that's great, but the next thing I want to do is let's go through a couple of examples. So let's start with example number one. The first example is the one I alluded towards earlier. I've got a small game server system, and I need four IP addresses for the four servers sitting on a rack here in my company. Now, Comcast is my provider, and Comcast business does a great job. I love them. No advertise. I like Comcast. So I actually go onto their website, and I see a page that looks something like this. So what they're basically saying is they'll give me one IP address, they will gimme five IP addresses, or they'll gimme 14 IP addresses. What are they talking about? So I've got a little setup here. So here are my four game servers. The thing you've got to remember with static IP is that you always have an IP address for your router. Now, normally, in our home networks, the router's sitting right there, Comcast or AT&T, whoever it is, gives us that router. But in this case, what we're doing is we're hooking up to a router upstream someplace. So what they're telling us is that instead of giving us six addresses, they're keeping one of the addresses for their upstream router. And that's where the five comes from. So in this case, what they're talking about is they're going to be giving us a WAC 29, just like you see here. One IP address is safe for their router, and that gives me five IP addresses for my four gaming systems. Yep, I have one extra IP address. And that's just how this stuff happens. It's not exactly perfect. So you know, that was fun. Let's try it one more time with example number two. So in this example, I'm actually going to take advantage of Comcast deal to give me some IP addresses. So I told them that I need a number of IP addresses. Oh, let's make it a bigger number. Let's say, I need eight IP addresses as an absolute minimum. So I call 'em up on the phone, and for 39.95 extra a month, I get a letter like this. - [Presenter] "Dear Mr. Myers, thank you for selecting IP Super Center as your internet service provider. Per your request for eight static IP addresses, we are pleased to provide you with an IP address block that will meet the requirements of your organization. Your assigned network IP address is 199.44.6.80 with a WAC 28 subnet mask. Your upstream router's IP address is 199.44.681. Your primary public DNS server's IP address is 199.75.76.8, and the secondary DNS server is 199.76.77.8. Should you require assistance, you may contact our technical support by email at support@ipsupercenter.com. We look forward to serving your internet access needs in the coming months and years. Sincerely, Winifred P Fiberforce. - What the heck does that all mean? Well, it's actually very simple. All you need to do when you get information like this is to write down the subnet mask and the network ID supplied to you from the actual ISP. So that's what I've done right here. So I went ahead and I put down the subnet mask, which is a WAC 28, and then I wrote down the network id. Now, if you remember in other episodes, I always say the network ID has to end with a zero. Well, it really does. Watch this. So we know it's a WAC 28. So let me put my little piece of bamboo in here, and you'll see the network ID actually does end with a zero. Do you see those four zeros? So to get the real IP address, we're done with this part now. All we've got to do is we're in control of these four digits. So it can go from anywhere, from all zeros to all ones. Now, wait a minute, it can't be all zeroes and all ones. You always have to subtract two. So I'm just going to cheat and do this. So I go from 81 to 94 which means I have the IP addresses of 199.44.6.81, all the way to 199.44.6.94. You might want to pause and double check the math there to make sure it makes sense to you. Now, keep in mind that the ISP has to reserve one of those IP addresses for themselves, and that's why they went ahead and said, 199.44.6.81 is going to be my gateway router, 'cause they hold onto that, because that's how all of my computers are going to connect. Now, this is just two examples of subnetting, but these are two of the most common types of examples you're going to see out there. You might want to play with this a little bit more, get a little bit more practice, and you, too, will be comfortable with CIDR subnetting.