1. Overview

There has been an exponential growth of internet-connected devices nowadays. As a result, efficient methods are needed to manage the range of available IPv4 addresses. Notably, the Classless Inter-Domain Routing (CIDR) mechanism solves this issue by optimizing IP address allocation.

In this tutorial, we’ll see the steps to convert IP address ranges into CIDR notation.

2. Classful and Classless IP Addressing

Earlier, IP addressing used a classful approach. It categorized IP addresses into predefined classes: A, B, C, D, and E. Each class had a fixed range and a default subnet mask, simplifying initial network designs. For instance, Class A was suitable for large networks with a default subnet mask of 255.0.0.0. Similarly, Class C suited smaller networks with a subnet mask of 255.255.255.0.

However, the rigid boundaries of classful addressing led to several limitations. To address these limitations, Classless Inter-Domain Routing (CIDR) was then introduced.

Unlike classful addressing, CIDR doesn’t adhere to fixed classes. Instead, it uses variable-length subnet masking (VLSM). Thus, it enables the division of IP address space based on actual network requirements. This flexibility optimizes IP address utilization and effectively allows for varying network sizes.

3. Limitations of Classful IP Addressing

Classful IP addressing, while straightforward, has several limitations.

3.1. Inefficient IP Utilization

Classful addressing often leads to the under-utilization or over-utilization of IP addresses. For example, if a Class A address is set to a small network, there is a significant waste of IP addresses. Similarly, Class C addresses are insufficient for larger networks.

3.2. Scalability Issues

As an organization expands, network scalability issues arise. Moreover, this situation is further exacerbated by more IoT devices and applications. Thus, network scaling isn’t possible without redesigning the address scheme.

3.3. Routing Table Bloat

Furthermore, classful routing generates larger routing tables. As a result, routers have to maintain entries for each classful network. This burden slows down routing processes. Thus, it reduced overall network efficiency.

4. What Is CIDR?

Classless Inter-Domain Routing (CIDR) is a significant advancement in IP address management. It was introduced in the mid-1990s. CIDR eliminates the strict class boundaries inherent in classful addressing. Thus, it enhances the flexibility and efficiency of IP addressing.

4.1. Key Features of CIDR

Let’s see some of the key features of CIDR:

  • Variable-Length Subnet Masking (VLSM): CIDR allows subnet masks of varying lengths, specific to network needs
  • Route Aggregation: CIDR aggregates multiple IP networks into a single routing table entry, thereby reducing routing table size and improving routing efficiency
  • Enhanced IP Utilization: by allocating IP addresses based on actual requirements, CIDR minimizes address waste and maximizes utilization

Thus, CIDR provides a couple of benefits in IP networking.

4.2. CIDR Notation

A CIDR notation is a pair of an IP address along with its subnet mask:

<IP Address>/<Prefix Length>

For example, 192.168.1.0/24 denotes an IP address with a subnet mask of 255.255.255.0. Here, /24 signifies that the first 24 bits are designated for the network portion.

5. How Does CIDR Work?

CIDR allows flexible subdivisions of IP address spaces, enabling precise allocation based on network requirements.

This section explains how CIDR works. It also includes a CIDR subnet table and two practical examples.

5.1. CIDR Subnet Table

The CIDR subnet table references common subnet masks and their corresponding prefix lengths.

Let’s see a part of the CIDR subnet table:

Prefix Length

Subnet Mask

Number of Hosts

/32

255.255.255.255

1

/31

255.255.255.254

2

/30

255.255.255.252

4

/29

255.255.255.248

8

/28

255.255.255.240

16

/27

255.255.255.224

32

/26

255.255.255.192

64

/25

255.255.255.128

128

/24

255.255.255.0

256

/23

255.255.254.0

512

/22

255.255.252.0

1,024

/21

255.255.248.0

2,048

/20

255.255.240.0

4,096

/19

255.255.224.0

8,192

/18

255.255.192.0

16,384

/17

255.255.128.0

32,768

/16

255.255.0.0

65,536

The above table organizes the data into three columns: Prefix Length, Subnet Mask, and Number of Hosts. As a result, it gives a clear and concise view.

5.2. Working Examples

Let’s take the task of converting the IP address range 192.168.1.0 to 192.168.1.255 into CIDR notation.

First, we find the number of hosts. The given range spans from 192.168.1.0 to 192.168.1.255 which totals 256 IP addresses.

Next, we look for the suitable prefix length. For this purpose, we refer to the CIDR subnet table. Notably, a prefix length of /24 accommodates 256 hosts.

Thus, the IP range from 192.168.1.0 to 192.168.1.255 is represented in CIDR notation as 192.168.1.0/24.

Let’s take another example. Here, we convert the IP address range from 10.0.0.0 to 10.0.0.63 into CIDR notation.

Notably, the given range has 64 IP addresses. Thus, we’ve got 64 hosts. Again, from the CIDR table, we look for the suitable prefix. The prefix length that fits this number of hosts is /26.

Thus, the range 10.0.0.010.0.0.63 translates to 10.0.0.0/26 in CIDR notation.

5.3. Subnetting with CIDR

Subnetting with CIDR is dividing a larger network into smaller subnets based on given details. Moreover, this division is followed by extending the network prefix.

To summarize, subnetting with the CIDR process has three main steps:

  1. determining the number of subnets
  2. calculating the new prefix length
  3. defining the subnets

The number of subnets and hosts can be obtained using different formulas:

  • number of subnets: 2 ^ number of bits required to get the desired number of subnets
  • number of hosts per subnet: 2 ^ (remaining host bits − 2) (we subtract 2 for network and broadcast addresses)

Let’s take the case of the 172.16.0.0/16 network. Here, we’ve got 65,536 IP addresses.

Let’s create four equal-sized subnets. Basically, four subnets require 2 more bits (since 2^2 = 4).

Our original prefix length was /16. Now, there are two more bits for subnetting. So, the new prefix length is /16 + /2 = /18.

Now, each subnet has a prefix length of /18. Thus, each takes in 2 ^ (32-18) addresses. This totals to 16,384 IP addresses.

Let’s configure the subnets. The first 18 bits are assigned to the network address part. So, we can change the remaining bits to get the respective IP address ranges:

1. 172.16.0.0/18 (172.16.0.0 – 172.16.63.255)
2. 172.16.64.0/18 (172.16.64.0 – 172.16.127.255)
3. 172.16.128.0/18 (172.16.128.0 – 172.16.191.255)
4. 172.16.192.0/18 (172.16.192.0 – 172.16.255.255)

The figure below shows how we arrived at the subnet ranges:

CIDR Subnets

Thus, CIDR can be used for efficient IP address allocation.

6. Conclusion

In this article, we saw how to convert an IP address range into CIDR notation. Overall, in the article, we covered several aspects of CIDR:

  • key features
  • CIDR working
  • CIDR subnet table
  • working examples

Finally, by understanding the conversion of IP ranges to CIDR, we can manage networks effectively.


原始标题:Convert IP Address Range to CIDR Notation

« 上一篇: Lamport Clock
» 下一篇: Multi-Headed Networks