Introduction To Subnetting
Introduction To Subnetting
By
Joshua Plata
Table of Contents
Introduction…………………………..……………………………………………………………………………2
Questions……………………………………………………………………………………………………7
Table…………………………………………………………………………………………………………10
Conclusion…………………………………………………………………………………………………………15
Glossary of Terms………………………………………………………………………………………………...16
1
Introduction
Subnetting, the act of splitting a network into multiple smaller networks, forms the basis of modern networking. The
process by which subnets are accurately calculated, however, is often an enigma not only to entry-level networking
students, but even to later-term networking students.
This manual strives to teach students of any level a simple method of calculating subnets accurately and quickly, and is
divided into three major sections, all of which are critical to understanding the basics of subnetting:
While the practical application of this knowledge is beyond the scope of this manual, it is the belief of the author that
understanding the mechanics of the process of calculating subnets will form a solid foundation upon which a deeper
understanding of networking principles can then be built.
2
Decimal to Binary Conversion
An understanding of decimal to binary conversion is critical not only for subnetting, but for many networking concepts
and tasks. This is because the IP addresses we’re used to seeing are actually decimal representations of binary numbers.
10.200.170.1
00001010.11001000.10101010.00000001
This is actually much less complicated than it looks. A binary number has eight places, each place containing either a one
or a zero. Each place in a binary number has a numeric value, as follows:
Place 0 0 0 0 0 0 0 0
Value 128 64 32 16 8 4 2 1
3
Decimal to Binary Conversion
Whenever a place contains a one, that numeric value is counted; a zero in a place is not. Therefore:
Binary Decimal
10000000 128
01000000 64
00100000 32
00000001 1
00000010 2
00000011 3
00010100 20
00010101 21
As you can see from the last three examples, when there are multiple ones, you simply add the numerical values for the
places they occupy. With this method, any number from 0 through 255 can be expressed within these eight places.
4
Terms and Concepts
While the volume of information that is outside the scope of this manual is substantial, there are certain terms and related
concepts that need to be understood before we attempt to explain the mechanics of subnetting.
Octet – each of the four positions in an IP address is referred to as an octet. In any given IP address, A.B.C.D, the octets are
A, B, C and D. This term is derived from the fact that the numbers in each these positions are made up of eight
bits; that is, an eight-digit binary number as previously discussed. There are a total of thirty-two bits in an IP
address/subnet mask.
Subnet Mask – a basic definition of the Subnet Mask (SNM) is that it indicates a network’s class and is used to divide it
into subnetworks; however, the SNM actually contains much more information than just that for someone
knowledgeable in its usage.
CIDR – Classless Inter-Domain Routing. The CIDR value expresses the subnet mask in terms of the number of binary
ones contained therein. For example, the subnet mask 255.0.0.0 contains eight ones (decimal 255 = binary
11111111); therefore, the CIDR value is expressed as /8 (i.e. 10.200.170.0/8).
5
Subnetting
This manual will cover the mechanics of subnetting for the scenario of a specific number of subnets needed. The answer
table will be in the standard format of subnetting tests at ECPI College of Technology. Here is an example of the format:
Problem: Your location has been assigned the network of A.B.C.D/E. You are tasked with dividing this network into X
subnets with Y hosts possible on each subnet.
6. How many hosts will this new subnet mask allow on each subnet?
6
Problem
Your location has been assigned the network of 57.128.0.0/10. You are tasked with dividing this network into 7 subnets
with max hosts possible on each subnet.
Questions
To calculate the original subnet mask, you look at the CIDR value. In this case, the CIDR value is /10. This means that in
the subnet mask, there are ten binary ones. Each octet of the subnet mask holds eight binary places. So a CIDR value of
/10, in binary, would look like:
11111111.11000000.00000000.00000000
From here, it’s a simple matter of binary to decimal conversion. An octet with all ones equals 255. The second octet, with
two ones (128+64), is equal to 192. Since the rest of the bits are zeros, that makes the original subnet mask 255.192.0.0.
This information is given in the problem. The answer is 7. Questions #2 and #3 are included to help new students think
through this process step-by-step.
7
Problem
Questions
To calculate the new subnet mask that will allow you the correct number of subnets, count on your fingers, starting at two
and doubling it until you reach a number that is equal to or greater than the number of subnets that are required. For
instance, to reach 7 subnets, you would count:
2–4–8
You needed three fingers to get to a number equal to or greater than 7, so you will add three to the original CIDR of /10.
This gives you a new CIDR of /13 which looks like:
11111111.11111000.00000000.00000000
Using binary to decimal conversion, we see that the first octet is 255 (all ones), and the second octet, with five ones
(128+64+32+16+8), is 248. Therefore the new subnet mask that will be used at this location is 255.248.0.0.
For this answer, think back to when you counted on your fingers. The number you stopped at was 8. That is how many
subnets the new subnet mask will allow.
8
Problem
Questions
6. How many hosts will this new subnet mask allow on each subnet?
To calculate the number of hosts per subnet, we use the formula 2X - 2, where ‘x’ is the number of zeros in the new subnet
mask. Since we already know that there are 13 ones in the subnet mask, out of a total of 32 bits, this leaves 19 bits that are
zeros. Two to the nineteenth power (219) is 524,288; subtract two, and we are left with 524,286. This is the number of hosts
available on each subnet.
9
Problem
Table
There is quite a bit of information contained in this table, so we will look at it one small step at a time. The completed
table will be included at the end of this section.
The network ID for the first subnet, 57.128.0.0, is given in the problem.
Subnet Network
ID
1 57.128.0.0
To calculate the network IDs for subnets 2 through 5, we look to the new subnet mask (255.248.0.0). We will subtract the
last non-zero octet in the new subnet mask (248) from 256. The result, 8, will be what we increment the network ID by.
Because the last non-zero octet was the second octet, the increment will occur there. Therefore, the network ID for the
second subnet will be 57.136.0.0 (second octet is 128 + 8), the network ID for the third subnet will be 57.144.0.0 (second
octet is 136 + 8), and so forth. The resulting table would look like this:
Subnet Network
ID
1 57.128.0.0
2 57.136.0.0
3 57.144.0.0
4 57.152.0.0
5 57.160.0.0
10
Problem
Table
Step 2 – Network IDs – Last Subnet
The calculation of the network ID for the last subnet is slightly different. For this subnet, we need to look at the original
subnet mask, which was 255.192.0.0. Other than that, the process begins the same; we subtract the last non-zero octet
(192) from 256, which gives us the increment (64).
The biggest difference in this case is that the increment shows us where the next network will be, not where the next subnet
will be. When we increment the last non-zero octet by 64, the resulting address is 57.192.0.0. This address is outside the
range of the 57.128.0.0/10 network. To find the network ID for the last subnet, we then decrement the last non-zero octet
(192) by the new subnet mask’s increment (8). The resulting network ID for our last subnet would then be 57.184.0.0.
Subnet Network
ID
1 57.128.0.0
2 57.136.0.0
3 57.144.0.0
4 57.152.0.0
5 57.160.0.0
LAST 57.184.0.0
11
Problem
Table
To find the first available host on a network, we merely add one to the last octet of the network ID. For example, for the
network 57.128.0.0, the first available host would be 57.128.0.1. This pattern repeats throughout. The resulting table
would be:
12
Problem
Table
The next step is to find the broadcast address, rather than the last available host. The reason for this will become clear
momentarily. The broadcast address is the last IP address before the next network address. In other words, the broadcast
address for the 57.128.0.0 network is the last IP address before 57.136.0.0.
To find the last address in the 57.128.0.0 network, look at the last non-zero octet in the next network ID (136) and
decrement it by one (135). Then change the remaining octets, with the value of zero, to 255. This will give us an IP
address of 57.135.255.255, which is the broadcast address for the 57.128.0.0 network. Repeat this process with the
remaining network IDs.
The only exceptions are subnet #5 and the last available subnet. This is because the next network ID for either one is not
listed in the table. For these network IDs, we must figure out the next subnet, as in Step 1. For example, with subnet #5,
this gives us a network ID of 57.168.0.0. Then we apply the formula for calculating the broadcast address. In the example
of subnet #5, we are left with the IP address of 57.167.255.255.
13
Problem
Table
The last available host calculation is similar to the first available host calculation. In this case, we decrement the last octet
of the broadcast address by one. Therefore, in the example of 57.135.255.255, the last available host would be
57.135.255.254. This was the reason for calculating the broadcast address first, to make this step easier.
14
Conclusion
While this manual did not address any of the practical applications of subnetting, it is the author’s hope that with the
steps shown here, networking students may develop a better understanding of the process of subnetting. I believe that
with a solid foundation in such a fundamental concept, students will be able to more effectively build their knowledge of
more complex networking concepts.
15
Glossary of Terms
binary - a base-2 number system using only ones and zeros
broadcast address - the last IP address of a network, used to communicate with any adjacent networks.
CIDR - Classless Inter-Domain Routing. A method of expressing the subnet mask as a total of the binary ones contained
therein.
host - any device requiring an IP address, such as a computer, router, printer, etc.
IP address - a unique identifier for any network device, consisting of four binary octets. It is represented as four decimal
numbers, 0 - 255, separated by periods.
last non-zero octet - the last octet of an IP address that is not a zero
network ID - the IP address identifying a network. It is the IP address directly before the IP address for the first host;
usually in the format x.0.0.0, x.x.0.0, or x.x.x.0.
subnet mask - a portion of an IP address that indicates a network’s class, size, and is used to divide it into subnetworks
16