VLSM Subnetting Examples and Calculation Explained

Looking for VLSM Subnetting examples or want to understand the complex VLSM calculation through the examples, then this tutorial is the prefect resource for you. It provides VLSM Subnetting examples which not only help you in learning the VLSM Subnetting but also assist you in performing the VLSM calculation.

For this tutorial I assume that you know what VLSM Subnetting is and how it is done. Since I have already explained VLSM Subnetting and its procedure in previous parts of this tutorial, in this part I will focus on VLSM examples.

This tutorial is the sixth part of the article “IP Subnetting in Computer Network Step by Step Explained with Examples”. Other parts of this article are following.

This tutorial is the first part of the article. It explains IP addressing and network addressing such as IP address, subnet mask, IP address types and IP classes in detail.

Basic Subnetting in Computer Networks Explained

This tutorial is the second part of the article. It explains what Subnetting is and why it is necessary in computer network along with the advantages of Subnetting.

Subnetting Tutorial - Subnetting Explained with Examples

This tutorial is the third part of the article. It explains the Subnetting concepts and terms such as network id, broadcast id, total hosts, valid hosts, power of 2, block size and CIDR in detail.

Subnetting Tricks Subnetting Made Easy with Examples

This tutorial is the fourth part of the article. It explains how to solve or answer any Subnetting related question in less than a minute with 50+ Subnetting examples.

VLSM Subnetting Explained with Examples

This tutorial is the fifth part of the article. It explains what VLSM Subnetting is and how it is done step by step including differences between FLSM Subnetting and VLSM Subnetting.

Supernetting Tutorial: - Supernetting Explained with Examples

This tutorial is the last part of the article. It explains Supernetting in detail with examples.

Subnetting charts

Before we take the examples of VLSM Subnetting, let’s build Subnetting chart for each IP class. Subnetting charts summarize all possible combinations of all Subnetting bits in all IP classes.

In VLSM Subnetting, we calculate how many networks and hosts the given Subnetting bits provide. Subnetting charts not only provide this information but also help us in selecting appropriate block sizes and subnet masks for segments.

Class A Subnetting chart

 CIDR Subnet mask Network bits Host bits Networks Block Size or Total Hosts Valid Hosts /8 255.0.0.0 0 24 1 16777216 16777214 /9 255.128.0.0 1 23 2 8388608 8388606 /10 255.192.0.0 2 22 4 4194304 4194302 /11 255.224.0.0 3 21 8 2097152 2097150 /12 255.240.0.0 4 20 16 1048576 1048574 /13 255.248.0.0 5 19 32 524288 524286 /14 255.252.0.0 6 18 64 262144 262142 /15 255.254.0.0 7 17 128 131072 131070 /16 255.255.0.0 8 16 256 65536 65534 /17 255.255.128.0 9 15 512 32768 32766 /18 255.255.192.0 10 14 1024 16384 16382 /19 255.255.224.0 11 13 2048 8192 8190 /20 255.255.240.0 12 12 4096 4096 4094 /21 255.255.248.0 13 11 8192 2048 2046 /22 255.255.252.0 14 10 16384 1024 1022 /23 255.255.254.0 15 9 32768 512 510 /24 255.255.255.0 16 8 65536 256 254 /25 255.255.255.128 17 7 131072 128 126 /26 255.255.255.192 18 6 262144 64 62 /27 255.255.255.224 19 5 524288 32 30 /28 255.255.255.240 20 4 1048576 16 14 /29 255.255.255.248 21 3 2097152 8 6 /30 255.255.255.252 22 2 4194304 4 2

Class B Subnetting chart

 CIDR Subnet mask Network bits Host bits Networks Block Size /Total Hosts Valid Hosts /16 255.255.0.0 0 16 1 65536 65534 /17 255.255.128.0 1 15 2 32768 32766 /18 255.255.192.0 2 14 4 16384 16382 /19 255.255.224.0 3 13 8 8192 8190 /20 255.255.240.0 4 12 16 4096 4094 /21 255.255.248.0 5 11 32 2048 2046 /22 255.255.252.0 6 10 64 1024 1022 /23 255.255.254.0 7 9 128 512 510 /24 255.255.255.0 8 8 256 256 254 /25 255.255.255.128 9 7 512 128 126 /26 255.255.255.192 10 6 1024 64 62 /27 255.255.255.224 11 5 2048 32 30 /28 255.255.255.240 12 4 4096 16 14 /29 255.255.255.248 13 3 8192 8 6 /30 255.255.255.252 14 2 16384 4 2

Class C Subnetting chart

 CIDR Subnet mask Network bits Host bits Networks Block Size /Total Hosts Valid Hosts /24 255.255.255.0 0 8 1 256 254 /25 255.255.255.128 1 7 2 128 126 /26 255.255.255.192 2 6 4 64 62 /27 255.255.255.224 3 5 8 32 30 /28 255.255.255.240 4 4 16 16 14 /29 255.255.255.248 5 3 32 8 6 /30 255.255.255.252 6 2 64 4 2

To learn how to build the Subnetting charts, please see the previous parts of this tutorial.

Examples of VLSM Subnetting

There are five IP classes; A, B, C, D and E. From there classes Subnetting can be done only in first three classes; A, B and C. To understand VLSM Subnetting in detail, let’s take one example from each class.

VLSM Example 1 (Class C Network)

VLSM Example 2 (Class B Network)

VLSM Example 3 (Class A Network)

Step by step VLSM calculation

Based on hosts’ requirement, arrange all segments in descending order and select appropriate block size for each segment.

VLSM Example 1
 No. Segment Host requirement Nearest block size Valid hosts in block 1 LAN Segment1 29 32 30 (32 -2) 2 LAN Segment 2 21 32 30 (32 -2) 3 LAN Segment 3 12 16 14 (16-2) 4 LAN Segment 4 8 16 14 (16-2) 5 WAN Link 1 2 4 2 (4-2) 6 WAN Link 2 2 4 2 (4-2) 7 WAN Link 3 2 4 2 (4-2) 8 WAN Link 4 2 4 2 (4-2)

While selecting the nearest block size, compare the host requirement with valid host instead of the block size itself. For example, LAN segment 4 needs 8 hosts, but we can’t use the block size 8 for it. As block size 8 offers only 6 valid hosts (8 -2) while we need 8 valid hosts for this segment. For this segment, we have to use the block size which provides 8 or more valid hosts such as block size 16. Same way for WAN links which need 2 hosts, we have to use the block size 4.

VLSM Example 2
 No. Segment Host requirement Nearest block size Valid hosts in block 1 VLAN1 240 256 254 2 VLAN2 200 256 254 3 LAN Segment 1 150 256 254 4 LAN Segment 2 50 64 62 5 WAN Link 1 2 4 2 6 WAN Link 2 2 4 2
VLSM Example 3
 No. Segment Host requirement Nearest block size Valid hosts 1 LAN Segment 3 350 512 510 2 LAN Segment 4 250 256 254 3 LAN Segment 1 80 128 126 4 LAN Segment 5 50 64 62 5 LAN Segment 2 20 32 30 6 WAN Link1 2 4 2 7 WAN Link2 2 4 2 8 WAN Link3 2 4 2 9 WAN Link4 2 4 2 10 WAN Link5 2 4 2 11 WAN Link6 2 4 2

Once segments are arranged based on hosts’ requirement and host requirements are converted in nearest block size, use following steps.

• Do Subnetting for the largest segment. From subnetted subnets, assign first subnet to it.
• If next segment has similar block size, assign next subnet to it.
• Repeat this process till the requirements are same.
• If next segment requires different block size, do Subnetting again for the block size of that segment and pick the subnet which comes after the occupied subnets. Occupied subnets are the subnets which provide the IP addresses which are already used.
• Just like above step, if next segment requires similar block size, use next subnet for it otherwise do Subnetting again.
• Repeat same steps till the last segment of the network.

Let’s implement above steps in our examples.

VLSM Example 1

The first largest segment (LAN Segment1) requires the block size 32. For 32 block size, we use the Subnetting of /27.

In class C, Subnetting of /27 provides us 8 networks (subnets) of block size 32.

0-31, 32-63, 64-95, 96-127, 128-159, 160-191, 192-223, 224-255

Let’s use the first subnet 0-31 for it.

Since second segment (LAN Segment2) also has the similar requirement, use the second subnet 32-63 for it.

Third segment (LAN Segment3) requires the block size 16 which is different from the second segment, so instead of using the subnet which provides block size 32, we will do the Subnetting again and use the subnet which provides block size 16.

In class C, Subnetting of /28 provides 16 networks of block size 16.

0-15, 16-31, 32-47, 48-63, 64-79, 80-95, 96-111, 112-127, 128-143, 144-159, 160-175, 176-191, 192-207, 208-223, 224-239, 240-255

If we exclude the occupied subnets, we will get the available subnets for this segment and next segments.

The subnets which provide the addresses which are already assigned are known as occupied subnets. In this Subnetting the occupied subnets are 0-15, 16-31, 32-47 and 48-63. These subnets provide the addresses (0 to 63) which are already assigned in previous segments.

Let’s use the first available subnet 64-79 from this Subnetting for the third segment (LAN Segment3).

Forth segment (LAN Segment4) also has the similar requirement. Let’s assign next available subnet 80-95 to it.

In class C, Subnetting of /30 provides us 64 networks of block size 4.

0-3, 4-7, 8-11, 12-15, 16-19, 20-23, 24-27, 28-31, 32-35, 36-39, 40-43, 44-47, 48-51, 52-55, 56-59, 60-63, 64-67, 68-71, 72-75, 76-79, 80-83, 84-87, 88-91, 92-95, 96-99, 100-103, 104-107, 108-111, 112-115, 116-119, 120-123, 124-127, 128-131, 132-135, 136-139, 140-143, 144-147, 148-151, 152-155, 156-159, 160-163, 164-167, 168-171, 172-175, 176-179, 180-183, 184-187, 188-191, 192-195, 196-199, 200-203, 204-207, 208-211, 212-215, 216-219, 220-223, 224-227, 228-231, 232-235, 236-239, 240-243, 244-247, 248-251, 252-255

Exclude the occupied subnets and use first four available subnets 96-99, 100-103, 104-107 and 108-111 for WAN links.

Following figure explains above steps and Subnetting.

Subnetting table for first example of VLSM
 Segment CIDR Subnet Mask Network Address Broad cast Address Valid host addresses LAN Segment1 /27 255.255.255.224 192.168.1.0 192.168.1.31 192.168.1.1 to 192.168.1.30 LAN Segment 2 /27 255.255.255.224 192.168.1.32 192.168.1.63 192.168.1.33 to 192.168.1.62 LAN Segment 3 /28 255.255.255.240 192.168.1.64 192.168.1.79 192.168.1.65 to 192.168.1.78 LAN Segment 4 /28 255.255.255.240 192.168.1.80 192.168.1.95 192.168.1.81 to 192.168.1.94 WAN Link 1 /30 255.255.255.252 192.168.1.96 192.168.1.99 192.168.1.97 to 192.168.1.98 WAN Link 2 /30 255.255.255.252 192.168.1.100 192.168.1.103 192.168.1.101 to 192.168.1.102 WAN Link 3 /30 255.255.255.252 192.168.1.104 192.168.1.107 192.168.1.105 to 192.168.1.106 WAN Link 4 /30 255.255.255.252 192.168.1.108 192.168.1.111 192.168.1.107 to 192.168.1.108

VLSM Example 2

In this example, first segment (VLAN1) requires the block size of 256.

In class B, Subnetting of /24 provides us 256 subnets and 256 hosts in each subnet.

0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ……………………………….. 252.0, 253.0, 254.0, 255.0

Let’s assign first subnet 0.0 to this segment.

Since second segment (VLAN2) and third segment (LAN Segment1) also have the similar requirement, instead of doing Subnetting again, let’s use the next available subnets from already subnetted subnets for these segments.

Assign second subnet 1.0 and third subnet 2.0 to the second segment (VLAN2) and third segment (LAN Segment1) respectively.

Fourth segment (LAN Segment2) requires the block size of 64 which is different and lower from current block size. Instead of using current subnets, let’s do Subnetting again for this segment.

In class B, Subnetting of /26 provides 1024 subnets with block size of 64.

0.0, 0.64, 0.128, 0.192, 1.0, 1.64, 1.128, 1.192, 2.0, 2.64, 2.128, 2.192, 3.0, 3.64, 3.128, 3.192, 4.0, 4.64, 4.128, 4.192………………………………….. 254.0, 254.64, 254.128, 254.192, 254.0, 254.64, 254.128, 254.192

Exclude already occupied subnets and use first available subnet 3.0 for this segment (LAN segment2).

Next two segments are WAN links. For WAN links we use the Subnetting of /30.

In class B, Subnetting of /30 provides 16384 networks with the block size of 4.

0.4, 0.8, 0.12, ….…… 3.0, 3.4, …………. 3.56, 3.60, .64, 3.68, 3.72, 3.78, …………………………… 255.248, 255.252

Just like we did above, exclude occupied subnets and assign first two available subnets 3.64 and 3.68 to the WAN Link1 and WAN Link2 respectively.

Subnetting table for second example of VLSM
 Segment CIDR Subnet Mask Network Address Broad cast Address Valid host addresses VLAN1 /24 255.255.255.0 172.168.0.0 172.168.0.255 172.168.0.1 to 172.168.0.254 VLAN2 /24 255.255.255.0 172.168.1.0 172.168.1.255 172.168.1.1 to 172.168.1.254 LAN Segment 1 /24 255.255.255.0 172.168.2.0 172.168.2.255 172.168.2.1 to 172.168.2.254 LAN Segment 2 /26 255.255.255.192 172.168.3.0 172.168.3.63 172.168.3.1 to 172.168.3.62 WAN Link 1 /30 255.255.255.252 172.168.3.64 172.168.3.67 172.168.3.65 to 172.168.3.66 WAN Link 2 /30 255.255.255.252 172.168.3.68 172.168.3.71 172.168.3.69 to 172.168.3.70

VLSM Example 3

The largest segment (LAN Segment 3) requires the block size 512.

In class A, Subnetting of /23 provides 32768 networks with the block size of 512.

0.0.0, 0.2.0, 0.4.0, …………………………………. 0.252.0, 0.254.0

Assign first subnet 0.0.0 to this segment.

The second largest segment (LAN Segment 4) requires the block size of 256.

In class A, Subnetting of /24 provides 65536 networks with the block size of 256.

0.0.0, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, ……………………… 0.252.0, 0.253.0, 0.254.0

Exclude the occupied subnets and assign first available subnet 0.2.0 to it.

The third largest segment (LAN Segment 1) requires the block size of 128.

In class A, Subnetting of /25 provides 131072 networks with the block size of 128.

0.0.0, 0.0.128, 0.1.0, 0.1.128, 0.2.0, 0.2.128, 0.3.0, 0.3.128, 0.4.0, 0.4.128 ………………… 0.254.0, 0.254.128 , 0.255.0 , 0.255.128

Assign first available subnet 0.3.0 to this segment.

The fourth largest segment (LAN Segment 5) requires the block size of 64.

In class A, Subnetting of /26 provides 262144 networks with the block size of 64.

0.0.64, 0.0.128, 0.0.192, 0.0.255, 0.1.64, …………………. 0.2.192, 0.2.255, 0.3.64, 0.3.128, 0.3.192, 0.3.255, 0.4.64 …………………. , 0.254.0 , 0.254.64 , 0.254.128 , 0.254.255

In this Subnetting, the first subnet with available addresses is 0.3.128. Assign it to this segment.

The fifth largest segment (LAN Segment2) requires the block size of 32.

In class A, Subnetting of /27 provides 524288 networks with the block size of 32.

0.0.32, 0.0.64, 0.0.96, 0.0.128 ………. 0.3.0, 0.3.32, 0.3.64, 0.3.96, 0.3.128, 0.3.160, 0.3.192, 0.3.224, 0.3.255, …………………. , 0.255.0, 0.255.32, 0.255.64, 0.255.92, 0.255.128, 0.255.224, 0.255.255

The first available subnet of this Subnetting is 0.3.192. Let’s assign it to this segment.

Next six segments are WAN links. For WAN links use the Subnetting of /30.

In class A, Subnetting of /30 provides 4194304 networks with the block size of 4.

0.0.0, 0.0.4, 0.0.8 …………………….…………….. 0.3.208, 0.3.212, 0.3.216, 0.3.220, 0.3.224, 0.3.228, 0.3.232, 0.3.236, 0.3.240, 0.3.248, 0.3.252, 0.4.0, 0.4.8, …………….. 0.255.240, 0.255.244, 0.255.248, 0.255.252

Assign subnets 0.3.224, 0.3.228, 0.3.232, 0.3.236, 0.3.240 and 0.3.248 to WAN links respectively.