CIDR and VLSM: Core Technologies for IP Address Planning
2025.04.28
With limited IPv4 address resources, how to efficiently allocate and manage IP addresses has become a key issue in network design. CIDR (Classless Inter-Domain Routing) and VLSM (Variable Length Subnet Mask) are two important IP address management technologies. They abandon the traditional A, B, and C class address division method and adopt a more flexible mask mechanism to greatly improve address utilization.
1. CIDR
1. Basic Concepts
CIDR (Classless Inter-Domain Routing) is a technology used for **Route Summarization**. It reduces routing table entries by merging multiple continuous subnets and improves the efficiency of Internet core routing (such as BGP).
2. CIDR calculation method
The core of CIDR is to find the common prefix of multiple subnets and determine a shorter mask to cover these subnets.
Calculation steps:
Convert the IP addresses of all subnets into binary form.
Compare from left to right to find the longest common prefix of all subnets.
The number of bits in the common prefix is the new CIDR mask.
Example: Merge 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24:
Common prefix: The first 22 bits are the same → 192.168.0.0/22 (covering 4 /24 subnets)
II. VLSM
1. Basic concept
VLSM (Variable Length Subnet Mask) is a subnet segmentation technology that allows subnet masks of different lengths to be used in the same main network to adapt to the needs of subnets of different sizes and improve the utilization rate of IP addresses.
2. VLSM calculation method
The core of VLSM is to allocate subnet masks on demand so that the number of hosts in each subnet is as close to the actual demand as possible to avoid waste.
Calculation steps:
Determine the number of hosts required for each subnet.
Calculate the number of host bits required (2^n - 2 >= number of hosts).
Determine the subnet mask (such as /26, /27, etc.) based on the number of host bits.
Divide from the main network step by step to avoid address overlap.
Example: The main network is 192.168.1.0/24, and three subnets need to be divided:
(1) Subnet 1 (60 hosts):
Requires at least 6 host bits (2^6 - 2 = 62).
Mask /26 → 192.168.1.0/26 (range: 192.168.1.1 - 192.168.1.62).
(2) Subnet 2 (30 hosts):
Requires at least 5 host bits (2^5 - 2 = 30).
Mask /27 → 192.168.1.64/27 (range: 192.168.1.65 - 192.168.1.94).
(3) Subnet 3 (10 hosts):
Requires at least 4 host bits (2^4 - 2 = 14).
Mask /28 → 192.168.1.96/28 (range: 192.168.1.97 - 192.168.1.110).
Tip: Subnet mask bits = 32 − host bits
3. Differences and connections between CIDR and VLSM
1. Main differences
2. Connections
Both are based on classless IP addressing, abandoning the traditional A/B/C class address restrictions.
VLSM is one of the basic technologies of CIDR, and CIDR can be regarded as an extended application of VLSM (reverse operation).
Modern network planning usually combines the two, for example:
Enterprise intranets use VLSM to divide subnets.
ISPs use CIDR to aggregate routes and reduce the size of BGP tables.
5. Summary
CIDR is used for route aggregation, which merges subnets by shortening the mask and optimizes Internet routing.
VLSM is used for subnet division, which allocates IP addresses in detail by extending the mask and improves address utilization.