Subnetting: Networking One Piece at a Time
When you apply for an IP address for your network, you
will be assigned
a Class C address unless you have some very exceptional
This is appropriate for many small organizations, but
it creates a
problem for organizations that need more than one network,
not meet the requirements for a class A or class B network.
to the problem is to divide the assigned class C subnet
networks by altering the netmask. While this may sound
easy, it can
in fact get quite complicated. This article gives you
for planning a subnet for a class C network.
A, B, and C Network Addresses
An IP address consists of four bytes, or octets. In
each of the network
address schemes, an IP address is divided into two portions:
portion and the host portion. These portions differ
for each of the
The first number in the IP address identifies the network
address belongs to. A class A address has a range of
1 to 126. In
binary, the first bit of the first octet is zero, as
shown in Figure 1.
This means that the first bit identifies the address
the remaining seven bits of the first octet identify
The remaining 24 bits can be used to identify the host.
first bit is zero, there are fewer than 128 class A
each network can contain literally millions of hosts.
A addresses are typically used to create a larger network
networks through the use of subnets. Creating a subnet
using a Class
A address is very easy. A potential network is illustrated
in Figure 2.
If the first two bits of the IP address consist of 1
0, then it is
a class B address, which establishes the address range
of 128 to 191.
The address format for a class B address is illustrated
in Figure 3.
In a class B network, the first two bits identify
the class of
network, the next fourteen bits identify the network
itself, and the
last sixteen bits identify the host. There are thousands
B networks available, and each network can contain thousands
Class B networks are predominantly used by universities
and some Internet
Service Providers. A sample class B network is shown
in Figure 4.
For a class C network, the first three bits of the IP
of 1 1 0, as shown in Figure 5. Here the first three
bits are class
identifiers, the next 21 bits are the network address,
and the last
eight bits identify the host. This combination calls
of class C network addresses, where each network is
composed of fewer
than 254 hosts. The typical Class C network is shown
in Figure 6.
IP addresses are generally expressed in dotted decimal
for example, 18.104.22.168. Each number represents a byte
in the address.
Alternatively, the address can be expressed as a single
number -- 22.214.171.124 would be expressed as 0x100010C.
Splitting a Class C Network
Splitting a class C network is much more difficult than
a class A or B network. The level of difficulty derives
from the fact
that there are only eight bits to manipulate in the
host address portion
fo a class C address, while in a class A network there
are 24 bits,
and in a class B network, 16 bits. Given that eight-bit
the only effective way to alter the number of bits in
a class C network
address is by creating subnets. To show exactly how
and where the
splitting occurs, I'll refer to the separate octets
by the following
N -- is the first octet
O -- the second octet
P -- the third octet
Q -- the last octet
In a standard class C network, the network portion of
the address consists of N.O.P. This is a constant, and
is the same
for each host on the network. The last octet, Q, must
for each host. It is this value that must be split in
order to create
An eight-bit number allows the representation of 256
-- from 0 (all bits off) to 255 (all bits on). As referenced
the Internet Request For Comments RFC 950, the values
of all zeros
and all ones must not be used for a host address.
Subdividing a class C network requires using some of
the bits in the
host portion of the address as part of the network portion.
this increases the number of possible networks, it decreases
of hosts that can be on each subnet.
The Internet RFC 950 also requires that the first and
of each subnet be reserved. This means that the actual
number of usable
subnets is two less than the total number of divisions.
if you want to split your class C network into two divisions,
cannot connect any hosts! If you want to have six subnets,
must split your network into eight divisions.
Figure 7 illustrates how the bits in the last octet
are set, and how
many subnets and hosts can be created for each. As the
what is effectively available is a minimum of 4 divisions
with 2 subnets
and 62 hosts per net, or a maximum of 64 divisions with
of 2 hosts each. The minimum could be used for two separate
networks, while the maximum could be used for a series
The optimal subnet type is determined by the maximum
number of users
that will be required on any subnet and the minimum
number of subnets
required. In a recent example, I was involved in revising
network for a technical services department from one
network to three.
To accomplish this, we decided to create eight divisions,
in six subnets, each with 30 hosts. The following sections
the steps and changes required to create a network of
Changing the Network
Referring again to Figure 7, you can see that splitting
a class C
address into eight divisions, or six subnets, requires
that the first
three bits in the last octet be fixed. The network portions
division are formed through the evaluation of the non-fixed
of the last byte. Figure 8 lists the bit combinations
how the class C address is split into subnets. The top
-- 8, 7, and 6 -- are fixed in that they are used as
the host address. This means that the available networks
The network entries consisting of all zeros and all
are disallowed, so these network subnets cannot be used.
address ranges of the networks established, the next
step is to determine
the broadcast addresses for each of the networks. The
of the last byte is ignored, and all of the remaining
bits are set
to one. The resulting broadcast address for each network
There is only one bradcast address in this case, because
all of the
subnets share the same number of bits for the host portion
With the network portions for the subnets and the corresponding
addresses determined, what remains is the netmask. The
subnet is interpreted
through the netmask, or subnet mask. If the bit is on
in the netmask,
that equivalent bit in the address is interpreted as
a network bit.
If the bit is off, then the bit is considered part of
the host address.
It is important to note that the subnet is known only
the rest of the Internet, the address looks like a standard
The standard netmask for a class C address is 255.255.255.0.
subnetted network, the first three bytes remain the
same. The fourth
byte is created by setting the network portion to ones,
and the host
portion to zero. Looking back at Figure 8, you can see
what the network
addresses will be; the same format is used for determining
This means that the netmasks for these subnets are:
N.O.P.32 N.O.P.31 255.255.255.32
N.O.P.64 N.O.P.63 255.255.255.64
N.O.P.96 N.O.P.95 255.255.255.96
N.O.P.128 N.O.P.127 255.255.255.128
N.O.P.160 N.O.P.159 255.255.255.160
N.O.P.192 N.O.P.191 255.255.255.192
Allocating IP Addresses
With the network split into subnets, the next step is
addresses. The range of addresses available is determined
the following formula:
The lowest host address is the network portion of
the fourth byte with the host portion set to one. The
value of zero
in the host portion is reserved.
The highest host address is the network portion of
the fourth byte with the host portion set to all ones
except for the
last bit (the maximum value is reserved for the broadcast
The allocation of addresses for the sample network is
illustrated in Figure 9.
The task of splitting an already established class C
subnets must be carefully planned and executed. The
danger here is
that you may wind up with a system where no one will
be able to talk
to anyone else. As a precautionary measure, you might
install a router
to split the network into the desired number of subnets,
them in segments. This allows the hosts on one network
amongst themselves while the others are being renumbered,
router handling the network traffic between them.
About the Author
Chris Hare is the Operations Manager for i*internet
Canadian Internet Service provider. He has worked in
the UNIX environment
since 1986, and in 1988 became the first SCO Authorized
in Canada. He is a co-auther of the book Inside UNIX,
is currently focused on networking, security, and perl.