Notes-The Prefix Length
Notes-The Prefix Length
Expressing network addresses and host addresses with the dotted decimal subnet mask address
can become cumbersome. Fortunately, there is an alternative method of identifying a subnet mask,
a method called the prefix length.
The prefix length is the number of bits set to 1 in the subnet mask. It is written in “slash notation”,
which is noted by a forward slash (/) followed by the number of bits set to 1. Therefore, count the
number of bits in the subnet mask and prepend it with a slash.
Refer to the table for examples. The first column lists various subnet masks that can be used with a
host address. The second column displays the converted 32-bit binary address. The last column
displays the resulting prefix length.
Note: A network address is also referred to as a prefix or network prefix. Therefore, the prefix length
is the number of 1 bits in the subnet mask.
When representing an IPv4 address using a prefix length, the IPv4 address is written followed by the
prefix length with no spaces. For example, 192.168.10.10 255.255.255.0 would be written as
192.168.10.10/24. Using various types of prefix lengths will be discussed later. For now, the focus
will be on the /24 (i.e. 255.255.255.0) prefix
Determining the Network: Logical AND
A logical AND is one of three Boolean operations used in Boolean or digital logic. The other two are
OR and NOT. The AND operation is used in determining the network address.
Logical AND is the comparison of two bits that produce the results shown below. Note how only a 1
AND 1 produces a 1. Any other combination results in a 0.
1 AND 1 = 1
0 AND 1 = 0
1 AND 0 = 0
0 AND 0 = 0
Note: In digital logic, 1 represents True and 0 represents False. When using an AND operation, both
input values must be True (1) for the result to be True (1).
To identify the network address of an IPv4 host, the IPv4 address is logically ANDed, bit by bit, with
the subnet mask. ANDing between the address and the subnet mask yields the network address.
To illustrate how AND is used to discover a network address, consider a host with IPv4 address
192.168.10.10 and subnet mask of 255.255.255.0, as shown in the figure:
IPv4 host address (192.168.10.10) - The IPv4 address of the host in dotted decimal and
binary formats.
Subnet mask (255.255.255.0) - The subnet mask of the host in dotted decimal and binary
formats.
Network address (192.168.10.0) - The logical AND operation between the IPv4 address and
subnet mask results in an IPv4 network address shown in dotted decimal and binary formats.
The diagram shows the ANDing process between an IPv4 host address and a subnet mask resulting
in the IPv4 network address of the host. The IPv4 host address is 192.168.10.10. Below that, the
address is converted into 11000000 10101000 00001010 00001010. Below that, the subnet mask of
255.255.255.0 is written. Below that, the subnet mask is converted to 11111111 11111111
11111111 00000000. A line is drawn underneath the binary equivalent of the subnet mask. Below
the line is the dotted-decimal and binary equivalent of the IPv4 network address as determined by
the ANDing process. A blue shaded box shows the first bit of the IPv4 host address, a 1, compared
to the first bit of the subnet mask, also a 1, resulting in a 1 as the first bit value in the IPv4 network
address. The IPv4 network address is 192.168.10.0 with a binary equivalent of 11000000
101001000 00001010 00000000.
The AND operation between an IPv4 host address and subnet mask results in the IPv4 network
address for this host. In this example, the AND operation between the host address of
192.168.10.10 and the subnet mask 255.255.255.0 (/24), results in the IPv4 network address of
192.168.10.0/24. This is an important IPv4 operation, as it tells the host what network it belongs to.
Address Classes
In 1981, IPv4 addresses were assigned using classful addressing as defined in RFC 790.
Customers were allocated a network address based on one of three classes, A, B, or C. The RFC
divided the unicast ranges into specific classes:
Class A (0.0.0.0/8 to 127.0.0.0/8) – Designed to support extremely large networks with more
than 16 million host addresses. It used a fixed /8 prefix with the first octet to indicate the
network address and the remaining three octets for host addresses.
Class B (128.0.0.0 /16 – 191.255.0.0 /16) – Designed to support the needs of moderate to
large size networks with up to approximately 65,000 host addresses. It used a fixed /16 prefix
with the two high-order octets to indicate the network address and the remaining two octets for
host addresses.
Class C (192.0.0.0 /24 – 223.255.255.0 /24) – Designed to support small networks with a
maximum of 254 hosts. It used a fixed /24 prefix with the first three octets to indicate the
network and the remaining octet for the host addresses.
Note: There is also a Class D multicast block consisting of 224.0.0.0 to 239.0.0.0 and a Class E
experimental address block consisting of 240.0.0.0 – 255.0.0.0.
As shown in the figure, the classful system allocated 50% of the available IPv4 addresses to 128
Class A networks, 25% of the addresses to Class B and then Class C shared the remaining 25%
with Class D and E. Although appropriate at the time, as the internet grew it was obvious that this
method was wasting addresses and depleting the number of available IPv4 network addresses.
The diagram is a pie chart showing the percentage of Class A, B, C, D, & E IPv4 addressing with the
total number of networks and hosts per class A, B, and C networks. Percentages are: class A =
50%, class B = 25%, class C = 12.5%, and class D and E = 12.5%. For the total number of networks
and total number of hosts per network: class A = 128 networks with 16,777,214 total hosts per
network; class B = 16,384 networks with 65,534 total hosts per network; and class C = 2,097,152
networks with 254 total hosts per network.
Class D & E
12.5%Class A
50%Class C
12.5%Class B
25%Class ATotal Networks: 128
Total Hosts/Net: 16,777,214Class BTotal Networks: 16,384
Total Hosts/Net: 65,534Class CTotal Networks: 2,097,152
Total Hosts/Net: 254
Classful addressing was abandoned in the late 1990s for the newer and current classless
addressing system. However, as we will see later, classless addressing was only a temporary
solution to the depletion of IPv4 addresses.
In the mid-1990s, private IPv4 addresses were introduced because of the depletion of IPv4 address
space. Private IPv4 addresses are not unique and can be used by any internal network.
It is important to know that addresses within these address blocks are not allowed on the internet
and must be filtered (discarded) by internet routers. For example, as shown in the figure, users in
networks 1, 2, or 3 are sending packets to remote destinations. The ISP routers would see that the
source IPv4 addresses in the packets are from private addresses and would, therefore, discard the
packets.