CIDR, VLSM, and Supernetting with Practical and Complete Examples

This article provides a comprehensive explanation of CIDR, VLSM, and Supernetting with diverse, step-by-step examples. We start with the basic concepts, then demonstrate real-world network scenarios with detailed calculations. Finally, a complete combined network design using all three techniques is presented to give you a deep and practical understanding.

CIDRVLSMSupernetting

~4 دقیقه مطالعه · آخرین به‌روزرسانی ۱۸ فروردین ۱۴۰۵

Introduction

With the rapid growth of the Internet, managing IPv4 addresses became a major challenge. The old classful addressing system caused massive waste of IP addresses. Three key techniques were developed to solve this: CIDR, VLSM, and Supernetting. In this article, each concept is explained with practical examples, precise calculations, and real network scenarios.

What is CIDR?

CIDR (Classless Inter-Domain Routing) is a classless method introduced in 1993. Instead of fixed class A, B, and C masks, it uses variable prefix lengths.

Standard notation:

192.168.10.0/24

The number after the slash (/) indicates the number of network bits.

Calculating Addresses in CIDR

General formula:

Number of addresses = 2^(32 - Prefix Length)
Usable hosts = 2^(32 - Prefix Length) - 2

Example:

192.168.10.0/26
Host bits = 32 - 26 = 6
Total addresses = 2^6 = 64
Usable hosts = 62

What is VLSM?

VLSM (Variable Length Subnet Mask) allows us to create subnets with different mask lengths within the same major network, significantly reducing IP address waste.

Example 1: Simple VLSM (Three Subnets)

Major network: 172.16.0.0/22 (1024 addresses)

Requirements:

  • 60 users → minimum 62 addresses (/26)
  • 20 users → minimum 30 addresses (/27)
  • 10 users → minimum 14 addresses (/28)

Step-by-step allocation:

172.16.0.0/26     → 62 hosts (main users)
172.16.0.64/27    → 30 hosts (secondary users)
172.16.0.96/28    → 14 hosts (servers)
172.16.0.112/28   → 14 hosts (reserved)

Total addresses used: 120 (very low waste).

Example 2: Advanced VLSM (Enterprise Network)

Major network: 10.0.0.0/20 (4096 addresses)

Requirements:

  • 200 users in headquarters → /23
  • 50 users in Branch 1 → /26
  • 20 users in Branch 2 → /27
  • 8 servers → /28
  • 4 printers → /29

Allocation:

10.0.0.0/23      → 510 hosts (headquarters)
10.0.2.0/26      → 62 hosts (Branch 1)
10.0.2.64/27     → 30 hosts (Branch 2)
10.0.2.96/28     → 14 hosts (servers)
10.0.2.112/29    → 6 hosts (printers)

What is Supernetting?

Supernetting (Route Summarization or Aggregation) combines multiple contiguous small networks into a single larger route. This reduces the size of routing tables and improves router performance.

Example 1: Supernetting Four Networks

Existing networks:

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24

Supernet:

192.168.0.0/22

Binary check for contiguity:

192.168.000.000   11000000 00000000
192.168.003.255   11000000 00000011

Common bits: 22 → /22.

Example 2: Supernetting Eight Networks

Networks: 172.16.16.0/24 to 172.16.23.0/24

Supernet:

172.16.16.0/21

Number of summarized networks: 8 (power of 2) and contiguous.

Complete Combined Scenario: Company Network Design

Company “TechNet” has major network 10.10.0.0/16.

Requirements:

  • 500 headquarters users → /23
  • 100 users in North Branch → /25
  • 50 users in South Branch → /26
  • 30 servers → /27
  • 10 IoT devices → /28

VLSM Allocation:

10.10.0.0/23     → Headquarters users
10.10.2.0/25     → North Branch
10.10.2.128/26   → South Branch
10.10.2.192/27   → Servers
10.10.2.224/28   → IoT devices

Supernetting for the core router:

10.10.0.0/21     → Summarizes all subnets

One single route is advertised instead of five separate routes.

Benefits and Applications

  • CIDR: Dramatically reduces the size of BGP routing tables on the Internet
  • VLSM: Saves up to 70% of IP addresses
  • Supernetting: Reduces router CPU load and improves packet forwarding speed

Comparison Table

CriteriaClassfulCIDR + VLSM + Supernetting
Mask FlexibilityFixedFully Variable
Address WasteHigh (50%+)Less than 10%
Routing Table SizeLargeSmall and Efficient
Current UsageObsoleteStandard for Internet and Enterprise Networks

Conclusion

CIDR, VLSM, and Supernetting are the foundation of modern network design. By practicing the examples above and mastering binary calculations, you can design any network efficiently. These techniques not only conserve IP addresses but also improve router performance and network scalability.

نوشته و پژوهش‌شده توسط دکتر شاهین صیامی

مقالات مرتبط

Systematic Network Troubleshooting: A Methodology Tying Everything Together

Every protocol and technology covered throughout this series is only useful if a problem involving it can actually be diagnosed and fixed efficiently under real-world pressure. This article presents a systematic troubleshooting methodology built around the OSI layers, walks through applying it to a realistic connectivity problem, and shows how the specific verification commands covered throughout this entire series fit into a structured diagnostic process.

ادامه

NETCONF, YANG, and Python: Programmatic Network Configuration at Scale

The REST APIs and JSON/YAML formats covered earlier in this series represent one approach to network automation, but NETCONF and YANG provide a more structured, standards-based alternative purpose-built for network device configuration. This article explains what distinguishes NETCONF from a simple REST API, covers how YANG models define exactly what configuration data looks like, and walks through using Python to programmatically interact with network devices.

ادامه

IPsec VPN Fundamentals: Securing Traffic Across Untrusted Networks

Connecting two sites across the public internet exposes traffic to interception unless it is properly encrypted, and IPsec provides the standard framework for building secure, authenticated tunnels between sites. This article explains the two-phase IKE negotiation process, covers the distinction between AH and ESP protocols, walks through configuring a basic site-to-site IPsec VPN, and covers essential verification commands.

ادامه

MPLS Fundamentals: Label Switching Explained

Traditional IP routing requires every router along a path to perform a full routing table lookup on every packet, but MPLS takes a fundamentally different approach by making that forwarding decision once and attaching a simple label that every subsequent router can use instead. This article explains the core label-switching concept, walks through how the Label Distribution Protocol builds the label forwarding tables that make this possible, and covers the practical benefits MPLS provides in real provider networks.

ادامه

BGP Route Reflectors and Confederations: Scaling iBGP Beyond Full Mesh

The iBGP full-mesh requirement, briefly mentioned earlier in this series, becomes a serious scaling problem as an autonomous system grows, requiring a number of sessions that increases quadratically with router count. This article explains exactly why full mesh does not scale, walks through how route reflectors solve this by relaxing BGP's normal route-propagation rules, and covers confederations as an alternative approach that divides a single AS into smaller sub-autonomous systems.

ادامه

OSPF Area Types Deep Dive: Stub, Totally Stubby, and NSSA

Multi-area OSPF, covered earlier in this series, already reduces database size by separating a network into areas, but OSPF offers further specialized area types that reduce routing table size even more aggressively by filtering out unnecessary external routes entirely. This article explains the LSA types that must be suppressed to create each specialized area type, walks through configuring stub, totally stubby, and not-so-stubby areas, and covers the specific trade-offs each design choice involves.

ادامه