1. Introduction

The Internet Protocol (IP) is one of the most relevant protocols in modern computer networks. This protocol provides logical addresses to machines, enabling them to communicate with each other. Over the years, IP got multiple versions and variations, such as IPv4, IPv6, and IPsec. However, due to the early adoption, IPv4 is still the most popular and widely adopted.

One essential characteristic of IPv4 is the possibility of dividing a big network into multiple smaller networks, which are called subnets. Subnets are logical and aim to improve network performance by reducing facilitating its management and reducing traffic overheads.

In this tutorial, we’ll study the subnets of the IPv4 protocol. Initially, we’ll have a brief review of the main concepts of IPv4. Furthermore, in this review, we’ll especially analyze the structure of IPv4 addresses. Thus, we’ll in-depth study the subnets of IPv4, detailing how they work, calculating the addresses range of a particular subnet, and identifying IPv4 address classes.

2. A Brief Review of IPv4

In current networks, IP enables different connected devices to communicate over networks. This protocol is present at the third layer of the OSI model and the second layer of the TCP/IP model. In particular, the fourth version of IP (IPv4) is widely adopted on the Internet. Thus, in this section, we’ll review some characteristics of IPv4. However, it is relevant to notice that other versions of IP, such as IPv6 and IPsec, also play essential roles in current networks.

In short, the IPv4 protocol addresses messages from a source to a destination represented with IPv4 address. So, routing routines done on the core network appropriately deliver messages considering these addresses. An IPv4 address, however, doesn’t necessarily represent a single device. The number of devices that receive a specific message depends on the employed addressing method. In IPv4, the supported addressing methods are unicast (one-to-one communication), multicast (one-to-many communication), and broadcast (one-to-all communication).

An IPv4 address is composed of four octets (32 bits) statically or dynamically defined for each connected device. So, there is a total of 4.3 billion possible addresses. However, the application of IPv4 requires extra information besides the source and destination addresses to allow communication on a network. This information, in addition to the source and destination addresses, forms the IPv4 header. Thus, the IPv4 header has at least 20 bytes describing several mandatory fields, such as version, length, fragmentation offset, time to live, checksum, and addresses. 

3. IPv4 Subnets

Subnets consist of a method to efficiently assign IP addresses, thus avoiding the waste of addresses and providing better management capacities for network operators. In other terms, subnets fragment the IPv4 addressing space to precisely accomplish particular demands of addresses. However, the contemporary concept of subnet emerged in 1993 with the publication of RFC 1517 by the IETF, which presents the Classless Inter-Domain Routing (CIDR). Before 1993, IP addresses were distributed considering only five classes: A, B, C, D, and E.

The IPv4 classes divide the addressing space into three static subnets. The first subnet considers class A, which uses the first octet of an IPv4 address to indicate the network, and the other octets to address the hosts. Thus, the second subnet is defined by class B, employing the first and second octets for establishing the network while the third and fourth octets indicate the hosts. Finally, the last subnet regards class C, employing the first three octets on the network definition and the last octet to specify the hosts. Class D and E, in turn, include specific addresses used, respectively, for multicasting and research purposes.

The following table summarizes information about the IPv4 addresses classes:

Rendered by QuickLaTeX.com

After the publication of CIDR, the five classes are still a reference, but the division and allocation of IPv4 addresses became more precise, as we will see in the following subsection.

4. Classless Inter-Domain Routing

The IETF proposed CIDR as a strategy to deal with the fast exhaustion of class B IPv4 addresses and the overload on routing tables. Before the CIDR, if some company demands a few thousand addresses, it should require a range of addresses (a network) from class B. However, the company will receive 65534 addresses and may waste multiple of them. With CIDR, however, a class B network can subdivide into several subnets with reduced addresses, better fitting the requirements of particular companies and other organizations.

The CIDR employs a variable-length subnet mapping strategy. The most traditional CIDR notation used with IPv4 consists of a number in the range from 0 to 32, typically called netmask, located after an IPv4 address. The symbol that separates the IPv4 address from the IPv4 address is a slash (/).

In summary, the netmask number represents the number of bits of the IPv4 address, starting at the first bit of the first octet, that defines the network. So, the result of (32 – netmask number) is the number of bits, starting at the last bit of the last octet, employed for addressing hosts in the network. The netmask has a binary 32 bits representation where the network bits have the value of 1, and hosts bits have 0. The binary representation of the netmask is used to calculate the range of IPv4 addresses of a subnet.

The following image depicts an example of the CIDR notation:

CIDR

It is relevant to note that we can map the IPv4 addresses classes to the CIDR notation. Class A, B, and C have a netmask of, respectively, /8, /16, and /24. Class D and E, in turn, encompass addresses mapped with different netmasks.

5. Conclusion

In this article, we learned about subnets in IPv4 networks. First, we had a brief review of IPv4, outlining its purposes and characteristics. Then, we studied the subnets in IPv4. We explored the traditional classification of IPv4 addresses and followed the transition to the CIDR strategy for defining subnets. Finally, we draw parallels between the traditional IPv4 classification and the CIDR strategy.

We can conclude that subnets are essential for the management of current IPv4 networks. Thus, with subnets, the addressing space of IPv4 can be efficiently explored and properly assigned.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.