Windows 10 has a convenient feature which allows you to specify your IP address depending on the wireless network you join – making it far easier to bounce around between multiple offices, work locations, coffee shops, and home. But rather than the standard “Subnet Mask” option we’re all used to seeing, it asks users to fill in their Subnet Prefix Length. What the heck should that number be!?
The short answer: Probably 24. That is the same as typing 255.255.255.0 in the old subnet mask field. If you traditionally typed another number in your Subnet Mask, look at the chart below and use the CIDR Prefix for what you’re familiar with typing!
But why? The long answer: To understand this, you need to first understand subnet masks in general. A subnet mask is really only used to help identify the CLASS of an IP address. It is broken in to four bytes (x.x.x.x) called “octets” (why? Because there are 8 bits in 1 byte. 8 = Octo). The most common example is a class “C” network: 255.255.255.0. In this example only the last byte / octet (the “0” in the subnet mask) can be changed on your current network. This gives you 254 usable addresses (1-255). If you have a class B network, you could use subnet mask 255.255.0.0 (meaning that either of the zeroes could be any combination of numbers from 1-255). Suddenly, you now have 65,534 available IP addresses. This is all done to ensure your devices only talk to the other devices you intend for them to talk to and you don’t accidentally interfere with other people’s nearby networks (routers enforce these rules that don’t allow cross talk between other networks, but this post is running long enough, we won’t get in to all of that).
Then came the Classless Inter-Domain Routing (CIDR) method for allocating IP addresses which helped create the subnetting standard for IPv4 address. The CIDR prefix as simply a shorthand representation which means the exact same thing. Even though it is written as a suffix on the end of an IP address, it is known as the prefix of the subnet. A “/24” network means 254 usable IP addresses, a /16 means 65,534! So, to make sense of this, let’s use some examples: an IP address with a Subnet Prefix such as “192.168.1.0/24” indicates that you are using the IP addressing scheme of 192.168.1.x with the subnet mask of 255.255.255.0 and you have the 254 usable addresses (1-255). If you were to write 192.168.0.0/16, you’re indicating 192.168.x.x and either one of those X’s can be 1-255 – that’s where we get the 65,534 addresses.
So, that’s SUBNET MASKS. But we still haven’t clarified just what is a prefix?
Computers read these addresses in binary, without the dots separating the addresses, and each of the bytes would be represented as 8 bits. If I were to write the number 255 in binary, it would look like 8 1’s in a row. A zero is simply 8 0’s in a row. In other words, a class “C” subnet mask (which we know as 255.255.255.0) would be represented in binary as 11111111111111111111111100000000 or 24 1’s followed by 8 zeroes. Are you starting to see where this is going? The prefix is simply the number of bits in the subnet mask that will be 1’s.
Let’s take one more example to try and drive this all home. Pop quiz time: how many usable addresses are there in a “slash 17” network, or a network with a prefix of 17? Well, let’s line up 17 1’s, and follow it up with 15 zeroes so that we have a total of 32 bits. We’ll take that long binary string and break it into 4 8-bit chunks. If we do a quick conversion and lay it out in octets like an IP address we get 255.255.128.0. If we scroll down and check our chart below, we can see that a prefix of 17 does, in fact, line up with a subnet mask of 255.255.128.0 and yields 32,766 usable IP addresses!
This is an extremely complicated concept and while many people are experts with Server Administration and Active Directory Roles and many other things, this one is heavily math driven and took me a long, long time to wrap my head around. Don’t feel bad if it takes you a while to really get the hang of, but I hope I was able to do a reasonable job of breaking it down for you!
|Subnet Mask||CIDR Prefix||Total IP Addresses||Usable IP Addresses||Number of Class C networks|