We covered chapters 11-13 today.
Chapter 11 was a big one. It covered subnetting and supernetting, and that’s not a topic to take lightly. We went over both at length today, and we’ll probably review it for the next couple of weeks. This topic is normally one that makes students’ heads spin, until they “get it”. Once they get it, it’s second nature.
We know that an IP address is made up of two parts: a network ID and a host ID. The only way we have to know which part of the IP address is the network ID and which is the host ID is to look at its subnet mask. The subnet mask is made up of 32 ones or zeros, represented in decimal form (just like the IP address). The portion of the subnet mask that’s made up of ones represents the bits in the IP address that are the network ID. Likewise, the portion of the subnet mask that’s made up of zeros represents the bits in the IP address that are the host ID. The subnet mask 255.255.255.0 would look like this in binary:
11111111.11111111.11111111.00000000
Everywhere there’s a 1, it’s the network ID. Where there’s a 0, it’s the host ID. So we could take an IP address, convert it to binary, and hold it up to the subnet mask (also converted to binary) and figure out which part is the network ID and which part is the host ID. By the way, this process is called ANDing. So let’s say that I have an IP address of 192.168.3.15 and a subnet mask of 255.255.255.0:
IP Address: 11000000.10101000.00000011.00000111
Subnet Mask: 11111111.11111111.11111111.00000000
------------------------------------------------
AND Result: 11000000.10101000.00000011.00000000 = 192.168.3.0
In the above example, we have a possibility of 254 hosts. But what if we need more? If you’ll remember, supernetting is done when you need to expand your subnet a little bit, but not make it so big as jumping from say a Class C address to a Class B.
For example, let’s say that I need 350 computers on the same subnet. Having a traditional Class C IP Address structure (subnet mask 255.255.255.0) will only allow for me to have 254 possible nodes. If I change my subnet mask to 255.255.0.0), that allows for me to have 65,534 — WAY more than I need! Supernetting allows me to gradually move up in size without going too overboard.
So let’s take this scenario of 350 computers and run with it.
The first thing I need to do is figure out how many host bits need to exist in my subnet mask. Too many and I have too many broadcasts polluting my network; not enough and well, I don’t have enough. Luckily, there’s a nice little formula I can use to figure out how many host bits I’ll have:
2^n - 2 > 350
Where n = number of host bits. This number will be the first whole integer that’s greater than 350. We could figure this out algebraically, but in time, you’ll be able to just do it in your head. (geek!) Just for illustration purposes, here are some possible answers:
2^5 - 2 = 30 <-- too small
2^6 - 2 = 62 <-- too small
2^7 - 2 = 126 <-- too small
2^8 - 2 = 254 <-- still too small
2^9 - 2 = 510 <-- just right...
So, just from figuring the math, we learn that we need 9 host bits. The subnet mask is 32 bits every time, so if 9 of those bits are host ID bits, the other 23 must be network ID bits, right? So here’s how that would look in binary:
11111111.11111111.11111110.00000000 = 255.255.254.0
And that’s how you make your subnet bigger to accomodate more hosts. The next step would be to figure out the possible ranges of our IP addresses. Just as a review, the first and last IP addresses in a range cannot be used by host machines — the first address is the network ID, and the second one is used as a broadcast address.
What we’re going to do is examine the subnet mask and find the “interesting” octet. An octet is interesting if it’s anything other than a 0 or a 255. In this case, the third octet, 254, is our interesting one. Once we find that interesting octet, we subtract it from 256. 256-254 = 2. This number is our “interval” number. Let’s show this in action.
So, let’s start with a private Class C address:
192.168.0.0
Then, we’ll go to the interesting octet, and add the interval to it. In this case, we’ll add 2 to 0 and get 2. The IP ranges will then begin with these addresses:
192.168.0.0
192.168.2.0
192.168.4.0
192.168.6.0
192.168.8.0
192.168.10.0
...
192.168.254.0
We’re not finished yet. What we need to do now is find the last number in each of these ranges. And we do that by simply looking at the beginning IP address of the next subnet and “rolling back the odometer” one address. The address right before 192.168.2.0 is 192.168.1.255, so that will be our last address in the first subnet. Here’s how it will look:
192.168.0.0 - 192.168.1.255
192.168.2.0 - 192.168.3.255
192.168.4.0 - 192.168.5.255
192.168.6.0 - 192.168.7.255
192.168.8.0 - 192.168.9.255
192.168.10.0 - 192.168.11.255
...
192.168.254.0 - 192.168.255.255
Making sense? Hopefully.
In addition to making our subnets bigger to accomodate more hosts, we can also make them smaller, to conserve IP addresses and shrinken our broadcast domains. Let’s say that we want a subnet that contains no more than 40 hosts. We use the same formula as before (2^n - 2) to determine how many host ID bits we’ll need. In this case, the number should get close to, but not exceed, 40. So here we go:
2^2 - 2 = 2 <-- too small
2^3 - 2 = 6 <-- too small
2^4 - 2 = 14 <-- too small
2^5 - 2 = 30 <-- still too small
2^6 - 2 = 62 <-- just right...
So we know that we’ll need 6 host bits.
Having 6 host bits leaves us with 26 network ID bits, and our subnet mask will then look like this:
11111111.11111111.11111111.11000000 = 255.255.255.192
Now, having that subnet mask, we need to determine the IP ranges for our possible subnets. We do this the exact same way as before. First, we’ll look at our “interesting” octet. This time, it’s the fourth octet and has the value of 192. We’ll subtract 192 from 256 and get 64. 64 is our “interval”. Now, we’ll start writing out the possible IP address ranges, and we’ll begin with 192.168.0.0 again, and add our interval to the “interesting octet. In this case, we’ll get:
192.168.0.0
192.168.0.64
192.168.0.128
192.168.0.192
192.168.1.0
192.168.1.64
...
192.168.255.192
And again, we simply take 1 address less than the next range’s start. That will give us these ranges:
192.168.0.0 - 192.168.0.63
192.168.0.64 - 192.168.0.127
192.168.0.128 - 192.168.0.191
192.168.0.192 - 192.168.0.255
192.168.1.0 - 192.168.1.63
192.168.1.64 - 192.168.1.127
...
192.168.255.192 - 192.168.255.255
So.
Hopefully this makes a little more sense. This is definitely is a skill you’ll need to master, so make sure you practice this often!!
Homework:
- Chapter 11 IP Addresses handout (available in Files section)
- Chapter 12: Review Questions
- Chapter 13: Review Questions