Simple Tricks To Ace the Subnetting Portion of Any
Certification Exam
Author: Ted Rohling, Global Knowledge
Instructor, CISSP
Subnetting seems to be a battle of fighting bits, decimal
numbers, and countless methods and processes to convert from one to
the other. While the methods may be confusing, the mathematics
behind them is the same for all. In this paper, you will learn some
of the simpler ways to figure out many of the subnetting questions
that you will find on the industry certification tests.
Unlike some of the more complex methods, these methods use
subtraction, addition, multiplication, and division-no converting
from binary or decimal. As a matter of fact, if you can do the four
basic math functions, this networking training white paper can
teach you these failure-free methods quickly and easily.
Overview of Subnetting
The reason we subnet is to break larger IP networks into smaller
ones. Often we have networks that are the same size. These use a
fixed length subnet mask for all networks. Other network designs
employ different subnet masks, depending on the number of addresses
required for each subnet. This is called variable length subnet
masking or VLSM.
As I learned subnetting, I began to realize that subnetting is
much like my grandmothers kitchen. When my grandmother made pies,
she cut the pies in various configurations depending on the needs
of the pie eaters. Often, the pie was cut with all pieces the same
size. Other times she cut the slices in various sizes, depending on
who was eating. My grandfather always got the biggest piece . . .
go figure.
In the end analysis, subnetting is taking a pie, your assigned
address space, and cutting the address space into variously sized
pieces depending on need. My grandmother cut her pies with a knife.
We cut our address space by using subnet masks. By visually
inspecting the pie my grandmother cut, you could determine how big
each piece was. By looking at the address and subnet mask, you can
see how many addresses are found in each subnet and what those
addresses are.
Let's review some of the more important concepts related to
subnetting.
Address Class Identification
You will often need to identify the class of an IP address in
order to complete test questions successfully. Below is an address
class table to assist you.
| Address Class |
First Octet Value
Range |
First Octet Binary
Value |
| A |
0-127 |
0nnnnnnn |
| B |
128-191 |
10nnnnnn |
| C |
192-223 |
110nnnnn |
| D |
224-239 |
11110000 |
The Octet and the Binary Progression
An octet is an eight bit data element. When IP was being
developed, the term byte had two possible meanings, a seven bit
byte or an eight bit byte. The IP developers started using the term
"octet" to reflect the eight bit byte format. An eight bit data
element has the ability to store the binary equivalent of decimal
numbers from 0 to 255.
Binary Table
| 27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
| 128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
The subnet mask and IP addressing revolve around the table shown
above. This is the binary to decimal equivalent table. One of the
first things you might consider doing in a certification test
environment is to copy this table from memory on to your scratch
paper or erasable worksheet provided at the testing center. Another
table to record is below:
Mask Table
| Binary |
Mask |
Addresses |
| 00000000 |
0 |
256 |
| 10000000 |
128 |
128 |
| 11000000 |
192 |
64 |
| 11100000 |
224 |
32 |
| 11110000 |
240 |
16 |
| 11111000 |
248 |
8 |
| 11111100 |
252 |
4 |
| 11111110 |
254 |
2 |
| 11111111 |
255 |
1 |
This table contains the eight possible octet values for any mask
along with the decimal equivalent. It will be used to determine the
mask when the number of subnets required is given.
Mask-to-Prefix or Prefix-to-Mask Conversion
255.255.255.0 is equivalent to a prefix of /24.
If you see masks or prefixes on your exam, don't panic. The
prefix is simply another way to state the mask. The prefix contains
a count of the total number of 1 bits in the subnet mask. The
conversion is quite simple. You can use the mask table above to
help determine the number of bits in each octet of the mask.
To convert from mask to prefix: simply add
together the number of bits found in the mask. For example, the
mask 255.255.248.0 is equivalent to a /21 bit prefix. Here's how
the conversion is done.
255 = 8 bits
255 = 8 bits
248 = 5 bits
0 = 0 bits
The sum of 8 + 8 + 5 + 0 is 21.
Here's another example:
What is the prefix when the mask is 255.255.255.192?
255 = 8 bits
255 = 8 bits
255 = 8 bits
192 = 2 bits
The sum of 8 + 8 + 8 + 2 is 26. The correct answer would be
/26.
To convert from prefix to mask: rather than add, you will
subtract.
In this example, you are asked to convert the mask prefix /23 to
a mask. Here's how it is done.
Begin by subtracting 8 from the prefix
number.
23 - 8 = 15 255.
Then subtract another 8 from the
remainder
15 - 8 = 7 255.255.
Find the seven bit entry in the mask table and add it to the
mask
255.255.254.
Since there are no bits left, add 0 to the
mask
255.255.254.0
The answer is 255.255.254.0
Another way to arrive at the same solution is to take the prefix
and divide it
by
8.23 / 8 = 2 with a remainder of 7.
There are two 255s in the front of the mask with seven
additional bits in the third octet and no bits in the fourth.
255.255.254.0
I prefer the remainder method. Here’s another example.
Convert /29 to a subnet mask.
29 / 8 = 3 with a remainder of 5
There are three 255s in the mask with a five bit fourth octet.
255.255.255.248
What Mask To Use, Part 1
One of the problem classes used in certification tests is the
“what mask” class. You are given a description of a networking
situation and are asked to select the correct mask to use in
subnetting the network.
Here is a typical question:
XYZ Corporation is using the 192.168.100.0 private address to
implement a workgroups in their network. Each workgroup will
consist of 17 devices requiring IP addresses. One additional
address is required for the router interface in each subnet. What
subnet mask should XYZ use?
First, determine the number of addresses in each subnet; in this
case, 18. Next, round up to the next power of 2. The next larger
power of 2 beyond 18 is 32. Subtract 32 from 256. The result is
224. This is the fourth octet of the mask to complete this
subnetting problem: 255.255.255.224
This method works with Class C addresses where the number of
required addresses is known. It can also be extended to any
addressing situation where the number of addresses in each subnet
is known.
Another example:
XYZ Corporation is using 172.16.0.0 for their networking needs.
Each subnet requires 280 IP addresses including the router
interface. What subnet mask should be used?
For IP addressing requirement where the number of addresses is
greater than 256, divide the number of
addresses by 256. 280 divided by 256 is 1 with a remainder of 26.
If there is a remainder, add 1 to the quotient. Our operational
number is now 2. As we did before, subtract 2 from 256. The result
is 254 which is the third octet of the subnet mask for this
problem; 255.255.254.0.
The 192.168.100.0 network is a Class C network. The default mask
is 255.255.255.0.We will need to determine the value of the mask in
the fourth octet only.
The process in this example requires that we determine the
number of bits in the mask required to hold the five subnet
numbers. Using the binary table above, find the next decimal number
greater than five. The number is 8. Now, look above the 8 to find
the exponent of 2 that is equivalent to 8. That exponent is 3, 23 =
8. Locate the mask in the Mask Table with three binary ones. You
have found the last octet of the mask; 255.255.255.224. This
solution is fairly simple.
Here is an example for a Class A network with a large number of
subnets.
XYZ Corporation will be subnetting the 10.0.0.0 network into
18,000 subnets. Each subnet will contain the same number of
addresses. What subnet mask should they use?
We know that with a Class A address, our default mask will be
255.0.0.0. Next we need to determine what the remainder of the mask
will be.
The simple math example is to determine the number of bits
required to hold the number 18,000. With a calculator, that would
be simple. Without, we need to practice a bit of twos
multiplication. Start with the number 1, multiply by 2 and then
continue as illustrated below:
1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384 . . .
stop right there.
What we have done is prepare a simple, power of two table by
multiplying our preceding values by two each time. Now, count the
number of numbers you have recorded. There are 15 numbers in the
list indicating that 15 bits are required to hold the number
18,000. Why did we stop at 16348 and not continue? If we add all of
the numbers together, we would have 32,767. This is greater than
the 18,000 we needed. That would have allocated too many bits.
Now, what is the mask? We need 15 subnetting bits plus the 8
bits for the Class A mask. That’s a prefix of 23 bits; or a
/23. Converting /23 to a mask results in 255.255.254.0.
The Subnet Range of Addresses Problem
One of the more popular questions found on certification tests
is the “range of addresses” problem. In this type of problem you
are given an IP address and a subnet mask and are asked to identify
addresses that are in the same subnet as the given address. For
example:
You are trying to determine why a user cannot connect to a
server from their workstation. The workstation IP address and
subnet mask are given below.
IP address = 193.168.22.104
Subnet Mask = 255.255.255.224
Select the addresses that are in the same subnet as the IP
address given.
a.
193.168.22.114
c. 193.168.22.127
b.
193.168.22.69 d.
193.168.22.85
Depending on how you learned subnetting, you might try to
approach this using a technique using binary numbers. There is a
much easier way.
or a situation such as this, a class C address, the first step
is to subtract the last octet of the subnet mask from 256. That
will give you the number of addresses in each subnet.
256 – 224 = 32
Now, divide the last octet of the address by 32, the number of
addresses in each subnet.
104 / 32 = 3 (Forget about the fraction or
remainder part - you don’t need it.)
Next, multiply the number of addresses in each subnet by the
result of division above.
32 * 3 = 96
The beginning address of the subnet is 193.168.22.96! Since
there are 32 addresses in the subnet, the ending address is
193.168.22.127. 193.168.22.96 through 193.168.22.127 there are 32
addresses when counting inclusively.
The correct answer to the question above is a and c.
This method does not require any sophisticated mathematics, just
simple subtraction, division and multiplication.
Here’s another problem.
Class B – Same Thing, Only Different
This time a class B address is used.
172.90.12.22
255.255.248.0
Now we have a slightly different issue, but you arrive at the
solution the very same way. This time we could not care less about
the fourth octet of the address or mask. The fourth octet of the
mask is all zeros and does not indicate any subnetting structure.
The fourth octet is part of the host field of the address. The
subnetting structure is found in the third octet of the mask, the
248. Let’s see how this works out.
As we did before, subtract the third octet of the subnet mask
from 256.
256 – 248 = 8
In this case, the number 8 tells us how many groups of 256
addresses will be in each subnet. Now, divide the third octet of
the address by 8, the number of groups in each subnet.
12 / 8 = 1 (Forget about the fraction or remainder part . . .
you don’t need it.)
Multiply the number of groups by the result of division
above.
1
* 8 = 8
The beginning address of the subnet is 172.90.8.0! Since there
are 8 groups of 256 addresses in the subnet, the ending address is
172.90.15.255. 172.90.8.0 through 172.90.15.255 are 8 groups of 256
addresses when counting inclusively.
Other Problem Types
Most problems you will find on the certification exams can be
solved using the procedures above. Some of the questions will ask
about the network address, first usable address, last usable
address or the broadcast address for a network or subnet.
Remember, in this paper we are steering clear of binary so I
won’t go into that part of the discussion.
A couple of gentle reminders. Network addresses are always even
and broadcast addresses are always odd.First usable addresses are
always odd, last usable addresses are always even. This should help
in some of the process of elimination steps you might use in
test-taking.
Finding the network address is simple, finding the others is
just as easy.
The IP address of a device is 201.234.1.99 and the subnet mask
is 255.255.255.224. What is the last usable address in this
subnet?
Remember how we figured out the subnet address? Subtract 224
from 256 to determine the number of
addresses in the subnet. That result is 32 addresses in each
subnet. Now divide 99 by 32 and forget the remainder.
99 / 32 = 2 (subnets before this one)
Multiply 2 times 32 to get the subnet
address.
| Subnet Address |
First Usable Address
|
Last Usable
Address
|
Broadcast Address |
| 201.234.1.64 |
201.234.1.65 |
2001.234.1.126 |
201.234.1.127 |
| |
One more than
subnet address
|
One less than
broadcast
|
(Subnet address) +
(Addresses in subnet) - 1
Add .255 in fourth octet |
Here’s a class B example:
The IP address is 165.33.9.211, and the subnet
mask is 255.255.254.0
No subnet bits are found in the fourth octet so
let’s move to the third octet.
Subtract 254 from 256. There are two groups of
256 addresses in each subnet.
Divide 9 by 2 and discard the remainder.
9 / 2 =
4
Multiply 4 times 2 to determine subnet address. Place the
calculated subnet address in the third octet of the address and
zero in the fourth octet. The subnet address is 165.33.8.0. If we
were to examine that address in binary, we would note that the host
address is all zeros, the identifier set aside for network and
subnet addresses.
Here’s a class A example:
| Subnet Address |
First Usable Address |
Last Usable Address |
Broadcast Address |
| 10.55.192.0 |
10.55.192.1 |
10.55.255.254 |
10.55.255.255 |
| |
One more than subnet
address |
One less than broadcast |
Subnet address + number of
groups minus 1
Add .255 in fourth octet |
The IP address is 10.55.229.44, and the subnet
mask is 255.255.192.0
No subnet bits are found in the fourth octet so
let’s move to the third octet.
Subtract 192 from 256. There are 64 groups of 256
addresses in each subnet.
Divide 229 by 64 and discard the remainder.
229 / 64 = 3
Multiply 64 times 3 to determine subnet address.
Place the calculated subnet address in the third octet of the
address and zero in the fourth octet. The subnet address is
10.55.192.0. If we were to examine that address in binary, we would
note that the host address is all zeros, the identifier set aside
for network and subnet addresses.
Related Courses
Understanding Networking Fundamentals
TCP/IP Networking