Wiki DE Start in the browser

Wiki › Basics

Subnetting and VLSM

Split a network into smaller ones, read masks and prefixes, compute host range and broadcast – evenly or as needed.

Layer
3 (Vermittlung)
Standard
RFC 1918, RFC 4632

Network part and host part

An IPv4 address has 32 bits. The mask says how many bits at the front identify the network; the rest numbers the devices in the network. /24 (255.255.255.0) means 24 bits network, 8 bits host.

PrefixMaskAddressesusable
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/30255.255.255.25242 (transit network between routers)

The first address is the network address, the last the broadcast; the device addresses lie in between.

Example

The network 192.168.10.0/24 is to be split into four equal networks. Four networks need 2 more bits: /26. Each network has 64 addresses:

NetworkHost rangeBroadcast
192.168.10.0/26.1 – .62192.168.10.63
192.168.10.64/26.65 – .126192.168.10.127
192.168.10.128/26.129 – .190192.168.10.191
192.168.10.192/26.193 – .254192.168.10.255

VLSM: as needed

With VLSM (variable-length subnet masks) every network only gets as much as it needs. Start with the largest: 100 devices need /25, 50 devices /26, the router link /30. This keeps address space for later.

Private addresses for your own networks are listed in RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (more in Special address ranges).

How many hosts?

With h host bits a network has 2^h addresses, of which 2^h − 2 are for devices (network address and broadcast are left out). The other way round: 50 devices need 2^h − 2 ≥ 50, so h = 6 (62 devices), the prefix is 32 − 6 = /26.

WantedCalculation
network addressaddress AND mask (all host bits set to 0)
broadcastnetwork address with all host bits set to 1
first hostnetwork address + 1
last hostbroadcast − 1

CIDR and route summarisation

There used to be fixed classes: A (1–126, /8), B (128–191, /16), C (192–223, /24). Since CIDR (Classless Inter-Domain Routing, RFC 4632) any prefix length is valid; the classes are history.

CIDR also allows the opposite of subnetting: combining several networks into one route (summarisation, supernetting). Four networks 192.168.0.0/24 to 192.168.3.0/24 share the first 22 bits:

192.168.0.0  = 11000000.10101000.000000|00.00000000
192.168.3.0  = 11000000.10101000.000000|11.00000000
common: 22 bits  →  192.168.0.0/22

A router then needs only one route 192.168.0.0/22 instead of four. That keeps routing tables small, which is especially important in the internet (RFC 4632). Summarising only works for contiguous blocks whose number is a power of two and which start on a matching boundary; otherwise the summary route also covers other networks.

How to do it in leyoNET

The same text as in the app’s help (F1 key).

Subnetting

A network can be split into smaller subnets by lengthening the prefix: 192.168.1.0/24 becomes two /25 or four /26. Each subnet loses two addresses (network and broadcast). With VLSM each subnet gets exactly the size it needs. The IP calculator does both.

IP calculator

Press I or the button next to an address field. It shows network, broadcast, first and last host, host count, wildcard and binary. Below it splits a network evenly or by need (VLSM). Apply writes the values straight into the device.

Practise

  • ★★★☆☆ Subnets by need (VLSM) · 4 goals · Worksheet (German)
  • ★★☆☆☆ Subnetting – Task 1: Four equal subnets · 12 goals · Worksheet (German)
  • ★★★★☆ Subnetting – Task 2: Subnets by need (VLSM) · 9 goals · Worksheet (German)
  • ★★☆☆☆ UE03 Router01 – Task 3: mask /25 · 6 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

Standards

  • RFC 1918 – Address Allocation for Private Internets
  • RFC 4632 – Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan

Read on

Found a mistake or have an idea? Source of this page on GitHub.