100% FREE • NO LOGIN REQUIRED

Subnet & VLSM Calculator

Plan waste-free IP allocations using Variable Length Subnet Masking (VLSM). Visualize block utilization and generate production-ready MikroTik RouterOS scripts.

Penggunaan Subnet & VLSM
3 times
Privacy Guarantee
Zero-Logs • Protected
Last Active
01 Oct 2026
Major Network Configuration
IPv4 Subnetting
Quick Examples:
Practical Field Scenarios (1-Click Preset):
Subnet / Segment Requirements List
VLSM Golden Rule: MikRam automatically sorts segment allocations from largest to smallest host requirement (Descending). This is crucial for boundary alignment so each subnet starts on a valid multiple of its block size without wasted gaps.

IP Space Capacity Summary

Major Capacity
-
-
Total Hosts Needed
-
-
Allocated IPs
-
-
Free IP Space
-
-
IP Block Allocation Map 0% Terpakai

MikroTik RouterOS Scripts


                

Detailed VLSM Subnet Allocation Table

Automatically sorted from largest to smallest host requirement
Segment / Role CIDR Subnet Mask Network Address Usable Host IP Range Broadcast Address Hosts Needed / Capacity Interface
In-Depth Technical Guide & Article

Panduan Lengkap Subnetting & Variable Length Subnet Masking (VLSM)

Master the underlying theory, mathematical formulas, and best practices for production deployment.

Buka Semua Panduan
Network Engineering Subnetting & VLSM 10 Min Read

Subnetting & VLSM: How to Allocate IP Addresses Without Wasting Space

MY
Written by Makarius Yuwono
• September 19, 2026 • Subnetting, VLSM, CIDR, MikroTik, IP Routing

“Subnetting is not merely dividing IP blocks. VLSM is the art of precisely allocating address space so each interface, hotspot segment, and PTP link receives an exact allocation without a single wasted byte.”

1 Why We Need Subnetting & The Problem of Wasteful IP Space

IPv4 addresses have an absolute mathematical ceiling: exactly 4,294,967,296 addresses (32-bit). In an era with billions of smartphones, IoT devices, base stations, and expanding ISP subscriber networks, address space is scarce.

Consider a residential development with 10 sectors. If the builder assigns 256 plots to every sector irrespective of actual requirements — even when one sector only needs 2 houses and another needs 50 — hundreds of plots sit abandoned and unused while others face severe shortages.

Core Purpose of Subnetting: Slicing a large parent network into smaller, isolated sub-networks (subnets) to maximize allocation efficiency, reduce broadcast domains, and bolster security between segments.

2 Core Concepts: Network ID, Broadcast ID, Host ID, and Subnet Mask

Every IPv4 address consists of two logical parts: the Network Portion (identifying the subnet boundary) and the Host Portion (identifying the specific endpoint on that subnet).

Network Address (Network ID)

The first address in the subnet block (all host bits equal 0). It identifies the subnet itself and is referenced by router routing tables. Never assign this to an individual host device!

Broadcast Address (Broadcast ID)

The last address in the subnet block (all host bits equal 1). Packets addressed here are flooded to all active nodes in the subnet. Never assign this to an individual device!

Usable Host Capacity Formula

When a subnet reserves h bits for host addresses:

Usable Hosts = 2h - 2

The - 2 subtraction is mandatory because the very first address is reserved as the Network ID and the last address is reserved as the Broadcast ID.

3 Understanding CIDR Notation (/24, /27, /30) & Quick Reference Table

CIDR (Classless Inter-Domain Routing) superseded legacy classful networking (Class A, B, C) by using prefix notation (/n), specifying how many bits from the left belong to the Network ID.

Prefix Subnet Mask Total IPs Usable Hosts Optimal Use Case
/24 255.255.255.0 256 254 Large hotspot zones, main office networks
/25 255.255.255.128 128 126 Medium WISP clusters / distribution nodes
/26 255.255.255.192 64 62 Guest VLANs / Cafe Hotspots (up to 60 users)
/27 255.255.255.224 32 30 Staff departments, training labs
/28 255.255.255.240 16 14 Local server VLANs, executive suites (10-14 hosts)
/29 255.255.255.248 8 6 CCTV camera networks, NVR management
/30 255.255.255.252 4 2 Point-to-Point (PTP) inter-router links

4 Traditional Subnetting (FLSM) & Its Limitations

In traditional subnetting, also known as FLSM (Fixed Length Subnet Mask), a major network is carved into subnets of identical prefix size.

For example, dividing 192.168.1.0/24 into 4 equal /26 blocks (64 addresses each):

Segment 1 (Hotspot 50 Hosts)

Allocated 64 IPs (62 usable). Clean and efficient fit.

Segment 2 (PTP Link 2 Router Hosts)

Only needs 2 IPs, but assigned 64 IPs. 60 IPs wasted completely and unavailable to other subnets!

This severe inefficiency motivated the development of VLSM.

5 VLSM (Variable Length Subnet Masking): Flexible Allocation

VLSM empowers network engineers to apply varying subnet masks across the same parent address space. Each segment receives the smallest power-of-two block size capable of accommodating its required host count.

Primary Advantages of VLSM:

  • Maximum Efficiency: Conserves up to 70% address space compared to uniform FLSM carving.
  • High Scalability: Leaves continuous unassigned blocks at the tail end for future VLAN or branch rollouts.
  • Route Summarization: Simplifies hierarchical routing table aggregation (OSPF / BGP).

6 The VLSM Golden Rule: Order Allocations from Largest to Smallest

This is the single most essential operational rule in VLSM engineering:

The Boundary Alignment Rule

A subnet with block size B must start on an integer multiple of B (e.g. a 64-block must start at .0, .64, .128, or .192). If you allocate a small subnet first (e.g. a 4-block for a PTP link starting at .0 through .3), the subsequent large 64-block cannot begin at .4 because 4 is not a multiple of 64! You would be forced to skip from .4 to .63, leaving 60 unallocated, fragmented addresses in limbo.

The Solution: Always sort segments from LARGEST host requirement to SMALLEST.

7 Step-by-Step Field Scenario (Real-World Case Study)

Let us divide a major network 192.168.1.0/24 (256 addresses) for the following 4 segments:

Segment 1: Hotspot 50 Hosts
Segment 2: Office 10 Hosts
Segment 3: CCTV 5 Hosts
Segment 4: PTP Link 2 Hosts
Step 1: Allocate Largest Segment — Hotspot (50 Hosts)

Needs 50 + 2 = 52 addresses. Nearest power of two is 26 = 64 addresses (/26).
• Network: 192.168.1.0/26
• Usable Hosts: 192.168.1.1 to 192.168.1.62
• Broadcast: 192.168.1.63

Step 2: Allocate Second Segment — Office (10 Hosts)

Needs 10 + 2 = 12 addresses. Nearest power of two is 24 = 16 addresses (/28). Starts immediately after prior broadcast (.63) at .64 (valid multiple of 16).
• Network: 192.168.1.64/28
• Usable Hosts: 192.168.1.65 to 192.168.1.78
• Broadcast: 192.168.1.79

Step 3: Allocate Third Segment — CCTV (5 Hosts)

Needs 5 + 2 = 7 addresses. Nearest power of two is 23 = 8 addresses (/29). Starts at .80 (valid multiple of 8).
• Network: 192.168.1.80/29
• Usable Hosts: 192.168.1.81 to 192.168.1.86
• Broadcast: 192.168.1.87

Step 4: Allocate Smallest Segment — PTP Link (2 Hosts)

Needs 2 + 2 = 4 addresses. Nearest power of two is 22 = 4 addresses (/30). Starts at .88 (valid multiple of 4).
• Network: 192.168.1.88/30
• Usable Hosts: 192.168.1.89 to 192.168.1.90
• Broadcast: 192.168.1.91

Final Accounting: Total allocated IP space is merely 92 addresses (from .0 to .91). You retain 164 free addresses (192.168.1.92 through 192.168.1.255) fully reserved for future scaling!
Test This Scenario in Our VLSM Calculator

View visual allocation block maps and copy RouterOS configuration scripts instantly.

8 Production Configuration on MikroTik RouterOS (Address, Pool, DHCP)

Translating the calculations above into MikroTik RouterOS CLI commands is clean and systematic:

1. Assign IP Addresses to Interfaces / VLANs

/ip address add address=192.168.1.1/26 interface=vlan-hotspot comment="Hotspot Gateway" add address=192.168.1.65/28 interface=vlan-office comment="Office Gateway" add address=192.168.1.81/29 interface=vlan-cctv comment="CCTV Gateway" add address=192.168.1.89/30 interface=ether2-ptp comment="PTP Link Gateway"

2. Configure IP Pools & DHCP Server Networks

/ip pool add name=pool-hotspot ranges=192.168.1.2-192.168.1.62 add name=pool-office ranges=192.168.1.66-192.168.1.78 /ip dhcp-server network add address=192.168.1.0/26 gateway=192.168.1.1 dns-server=8.8.8.8,1.1.1.1 comment="Hotspot Subnet" add address=192.168.1.64/28 gateway=192.168.1.65 dns-server=8.8.8.8,1.1.1.1 comment="Office Subnet"

9 5 Fatal Mistakes Network Engineers Make in Subnetting

1. Assigning Network or Broadcast IPs to Hosts

Assigning the first or last IP of a subnet (e.g. 192.168.1.63 on /26) induces severe ARP conflicts and packet drop issues.

2. Allocating Small Subnets First

Placing /30 at the beginning breaks boundary alignment for subsequent /26 blocks, stranding dozens of IPs in dead space.

3. Using /24 Subnets on Point-to-Point Links

Assigning a /24 subnet to a two-router link squanders 252 IPs. Always utilize a /30 (or /31 RFC 3021) subnet.

4. Overlapping Subnets from Calculation Errors

If segment A ends at .63 and segment B begins at .60, an overlap causes router routing tables to reject routes or produce routing loops.

5. Placing the Gateway IP Inside the DHCP Pool Range

If the router gateway is 192.168.1.1, the DHCP pool must start at 192.168.1.2 to prevent the router DHCP server from leasing out its own gateway address to an unsuspecting client.

MY
Makarius Yuwono

Software Engineering, Network Architecture & Telecommunications Specialist. This guide helps network engineers structure efficient, zero-waste subnet topologies ready for RouterOS production deployment.

Bermanfaat untuk Pekerjaan Jaringan?

Share This Free Tool With Your Network

Help fellow network engineers, ISP technicians, and WISP operators with these free MikroTik utilities.

MikRam Hotspot & Billing ISP

Otomatiskan Billing & Isolir Pelanggan MikroTik Anda

Tidak perlu lagi repot copy-paste skrip secara manual. MikRam menyinkronkan profil bandwidth, voucher hotspot, PPPoE, dan pembayaran otomatis dengan WhatsApp gateway & payment gateway resmi.