Skip to content

IPv4 VLSM

IPv4 - Variable Length Subnet Masking (VLSM)

Section titled “IPv4 - Variable Length Subnet Masking (VLSM)”

Variable Length Subnet Masking (VLSM) is a technique that allows network administrators to divide an IP address space into subnets of different sizes. This contrasts with fixed-length subnet masking (FLSM), where all subnets are the same size. VLSM is highly efficient for minimizing IP address wastage, a critical concern with the limited IPv4 address space.

Consider a scenario: an organization has a block of addresses, say 192.168.1.0/24. This /24 (Classless Inter-Domain Routing - CIDR notation) indicates the first 24 bits are for the network address, leaving 8 bits for hosts (2^8 - 2 = 254 usable IPs). If this organization has departments with varying needs – e.g., Sales (100 hosts), Purchase (50 hosts), Accounts (25 hosts), and Management (5 hosts) – using fixed-size subnets would be inefficient. VLSM addresses this by tailoring subnet sizes to requirements.

The core idea of VLSM is to subnet a subnet. This is achieved by applying different subnet masks to different portions of a larger address block. Here’s a step-by-step approach to implementing VLSM for the example above:

Before allocating, it’s helpful to know the number of usable IP addresses different subnet masks (CIDR prefixes) provide for a given block. For example:

  • /25 (Mask 255.255.255.128): 128 total IPs, 126 usable host IPs
  • /26 (Mask 255.255.255.192): 64 total IPs, 62 usable host IPs
  • /27 (Mask 255.255.255.224): 32 total IPs, 30 usable host IPs
  • /28 (Mask 255.255.255.240): 16 total IPs, 14 usable host IPs
  • /29 (Mask 255.255.255.248): 8 total IPs, 6 usable host IPs
  • /30 (Mask 255.255.255.252): 4 total IPs, 2 usable host IPs (often for point-to-point links)

Note: Each subnet reserves two addresses: one for the network ID and one for the broadcast address.

Step 2: Sort Requirements in Descending Order

Section titled “Step 2: Sort Requirements in Descending Order”

List the host requirements from largest to smallest. This is crucial for efficient allocation.

  • Sales: 100 hosts
  • Purchase: 50 hosts
  • Accounts: 25 hosts
  • Management: 5 hosts

Step 3: Allocate for the Largest Requirement

Section titled “Step 3: Allocate for the Largest Requirement”

Sales needs 100 hosts. The smallest subnet that can accommodate this is a /25 (126 usable IPs).

Let’s assign 192.168.1.0/25 to Sales. This subnet uses addresses from 192.168.1.0 to 192.168.1.127.

  • Network ID: 192.168.1.0
  • Usable Range: 192.168.1.1 - 192.168.1.126
  • Broadcast ID: 192.168.1.127
  • Subnet Mask: 255.255.255.128

Step 4: Allocate for the Next Largest Requirement

Section titled “Step 4: Allocate for the Next Largest Requirement”

Purchase needs 50 hosts. The next available address is 192.168.1.128. A /26 subnet (62 usable IPs) is suitable.

Assign 192.168.1.128/26 to Purchase. This subnet uses addresses from 192.168.1.128 to 192.168.1.191.

  • Network ID: 192.168.1.128
  • Usable Range: 192.168.1.129 - 192.168.1.190
  • Broadcast ID: 192.168.1.191
  • Subnet Mask: 255.255.255.192

Accounts needs 25 hosts. The next available address is 192.168.1.192. A /27 subnet (30 usable IPs) is suitable.

Assign 192.168.1.192/27 to Accounts. This subnet uses addresses from 192.168.1.192 to 192.168.1.223.

  • Network ID: 192.168.1.192
  • Usable Range: 192.168.1.193 - 192.168.1.222
  • Broadcast ID: 192.168.1.223
  • Subnet Mask: 255.255.255.224

Management needs 5 hosts. The next available address is 192.168.1.224. A /29 subnet (6 usable IPs) is suitable.

Assign 192.168.1.224/29 to Management. This subnet uses addresses from 192.168.1.224 to 192.168.1.231.

  • Network ID: 192.168.1.224
  • Usable Range: 192.168.1.225 - 192.168.1.230
  • Broadcast ID: 192.168.1.231
  • Subnet Mask: 255.255.255.248

By using VLSM, the administrator efficiently allocated IP addresses:

  • Sales: 192.168.1.0/25 (126 hosts)
  • Purchase: 192.168.1.128/26 (62 hosts)
  • Accounts: 192.168.1.192/27 (30 hosts)
  • Management: 192.168.1.224/29 (6 hosts)

Addresses from 192.168.1.232 to 192.168.1.255 in the original /24 block remain available for future use or for point-to-point links. This demonstrates the efficiency of VLSM in conserving IP addresses compared to assigning fixed-size subnets for all departments. For further study, explore how routing protocols like OSPF and EIGRP support VLSM.