Subnetting: © 2001 Kevin Lillis, Klillis@sau - Edu
Subnetting: © 2001 Kevin Lillis, Klillis@sau - Edu
Example:
Network ID Host ID
To organize your network and allow for growth, you decide to use the 3rd octet to
subdivide your network into subnets.
In order to distinguish between the extended network prefix and the Host ID you use a
subnet mask.
A subnet mask fills each bit of the extended network prefix with a 1 and each bit of the
Host ID with a 0.
255.255.255.0
A router combines the destination IP address with the subnet mask, using a logical AND
operation, to determine the network address.
After combining the destination address with the subnet mask, the result is the extended
network prefix. In effect, the host potion of the address has been stripped off.
There is a default subnet mask for each of the three Classes of IP address:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Your company has a Class C network of 201.222.10.0 and you want to use
subnetting. You cannot simply use the next available octet following the Network ID as
in the previous example. If you did, there would be no portion of the IP address left for
the Host ID.
Therefore, you need to use one portion of the last octet as the Subnet ID and another
portion of the last octet as the Host ID.
This can be done in two ways. The first way is intuitive and involves simply
looking at the decimal values of various binary numbers and deciding the
minimum number of bits required to represent the number of subnets.
The second way is more analytic. The number of bits required is defined by
the following equation:
number of subnets = 2n – 2
Once you know the number of subnets required, you can solve the equation for
n to determine the number of bits to use for your Subnet ID.
17 = 2n – 2
Solving for n
17 = 2 n − 2
17 + 2 = 2 n
19 = 2 n
ln(19) = ln(2 n )
ln(19) = n ln(2)
ln(19)
=n
ln(2)
n ≈ 4.2
Since it makes no sense to talk about 4.2 bits, we will say that the number of
bits required to represent our 17 subnets is 5.
Step 3 – Determine the number of bits, m, needed for the Host ID field
This is defined as
In this example we have a Class C address which uses the first three octets (24
bits) for the Network ID. In the previous step we determined that n = 5. So
m = 32 – 24 – 5
m=3
in binary this is
Next, count n bits from the vertical line and draw a second vertical line.
These two vertical lines divide the 32 bit IP address into three sections,
corresponding to the Network ID, Subnet ID, and Host ID fields respectively.
The extended network prefix consists of the Network ID and Subnet ID fields.
Filling each bit in these fields with a 1 and filling the bits of the Host ID field
with 0 will give us the network mask.
number of subnets = 2n – 2
in this example n = 5, so
number of subnets = 25 – 2 = 30
In this example m = 3, so
In this example there are 30 possible subnets. We will consider only one.
201.222.10.8
In any IP address, the Host ID field can contain any combination of 1s and
0s, except the combination of all 1s and the combination of all 0s.
201.222.10.9
201.222.10.15