VLSM
VLSM is the process whereby you take a major network address and then break it down into different subnets with different subnet masks at various points. In the Cisco CCNA exam you may well be faced with a scenario where you are required to design an IP addressing scheme to fit certain requirements.
Throughout this article I am going to presume that you have read the Easy Way to Subnet guide at www.howtonetwork.net or if you have not, you already have a very good understanding of subnetting and IP addressing.
It is best to illustrate with an example.
FIG 1 – ACME Company with no VLSM
You may have spotted a few problems with the above addressing scheme. The most important issue is the breach of the conservation of IP addresses. If you are using RFC 1918 addresses (non routable such as 10.x.x.x) then perhaps you may not worry about address wastage but this is very bad practise and for Cisco exams you can guarantee an expectation that you will conserve IP addresses.
With a /28 mask or 255.255.255.240 you have 14 hosts per subnet. This may be fine for your LAN on either end but for your WAN connection you only need 2 IP addresses. You are wasting 12! We could change the masks to /30 or 255.255.255.252 but then for our LANs we will obviously need more than 2 hosts.
The first workaround is to buy a separate network address for each network (2 LANs and one WAN) but this would prove expensive and unnecessary. The other alternative is to break our subnet down further using VLSM which is actually what it was designed to do!
FIG 2 – ACME Company with VLSM
In FIG 2 we can see that the WAN link now has a /30 mask which gives us two usable hosts. We have a tighter addressing allocation. Should ACME expand (as companies do) we can easily allocate further WAN links and LANs.
FIG 3 – ACME with a new office
In FIG 3 we can see that ACME has now grown and added a remote office. Because you have taken the time to plan and allocate a carefully thought out VLSM scheme you can simply allocate the next block of IP addresses.
But Won’t The IP Addresses Clash?
This is a very common question and also very valid. Let’s say we have address 19.16.1.1/28 for one of our LANs, you will not therefore be able to use the IP address 19.16.1.1 with any other subnet mask. The IP address can only be used once no matter which subnet mask is attached to it.
It is a bit of a head scratcher for people who are new to networking or subnetting but it does work. Feel free to think on it some more or just accept that with VLSM (RFC 950) it is not possible to reuse IP addresses.
VLSM in the CCNA Exam
In the CCNA exam you may be asked to address a network using VLSM and allocate the correct masks to the WAN and LAN links. If you haven’t read the subnetting secrets section from www.howtonetwork.net then I strongly encourage you to do that. We are building on what you have learned on that section. Here is the subnetting secrets section.
Here is a network you have been asked to design an addressing scheme for.
FIG 4 – ACME II Company
In FIG 4 ACME II company has been allocated the network 200.100.100.x network with a default mask of 255.255.255.0. If we keep the standard mask we are left with one network with 254 usable hosts. If you want to check this for yourself please use the subnetting secrets cheat sheet onwww.howtonetwork.net or the downloadable copy here or the direct link to download is http://www.box.net/shared/yyx4y8y0zf.
If you use the bottom part of the subnetting secrets cheat sheet you can tick down eight places and see that we have one subnet with 256 – 2 hosts giving us 254. I don’t want to dwell on that part of the calculations because that is covered very well on www.howtonetwork.net.
Our challenge is this then. We have three serial connections and each only requires two usable host addresses. We have four LANs which need anything from 20 to 100 hosts. If we just design a mask to give us anything from 20 to 100 hosts we are going to be wasting a lot of addresses. To get 100 hosts (using the cheat chart) we tick down seven places giving us a mask of 255.255.255.128 (because we only have one bit left to tick down for the subnets portion). This gives us 126 hosts (128-2). We would then have two networks, one starting 200.100.100.0 and one starting 200.100.100.128. Not great to be honest. We need seven subnets (three WAN and four LAN) and some only require 20 hosts so why waste 108 addresses?
What we need to do is refer to the subnetting secrets cheat chart. If we use the bottom portion and tick down until we find a number close enough to give us the 100 hosts. The only number we can use is 128 which is seven ticks down. We are stealing seven bits from the host portion leaving us one bit for subnetting.
Powers of 2 | Subnets | Hosts -2 |
2 | √ | √ |
4 | √ | |
8 | √ | |
16 | √ | |
32 | √ | |
64 | √ | |
128 | √ | |
256 | ||
512 |
If we use the upper portion of the cheat chart then we will tick down one place to reveal the subnet mask of 128.
Subnet | |
128 | √ |
192 | |
224 | |
240 | |
248 | |
252 | |
254 | |
255 |
When we use the 128 subnet with ACME II companies IP address we get subnet 200.100.100.0 and subnet 200.100.100.128 both with a mask of /25 or 255.255.255.128. For our network needing 100 hosts we can use this. We will use 200.100.100.128 subnet for the network needing 100 hosts. For the first host we will use 200.100.100.129 and so on up to 200.100.100.229. So now we have:
Large LAN Hosts
200.100.100.128/25 – LAN (hosts 129-254)
200.100.100.0/25 – available for use or for VLSM
We need to allocate hosts to three remaining LAN networks and 3 WANs . The other three LANs all need anything from 20 to 30 hosts. If you tick down the hosts portion of the subnetting cheat chart you will get to 32 if you tick down five places and take two away to give us 30 hosts. If we steal 5 bits from the host portion we are left with 3 bits for the subnet (because there are 8 bits in every octet).
Powers of 2 | Subnets | Hosts -2 |
2 | √ | √ |
4 | √ | √ |
8 | √ | √ |
16 | √ | |
32 | √ | |
64 | ||
128 | ||
256 | ||
512 |
Tick down three places on the subnets section of the cheat chart to reveal a subnet mask of 224. This mask will give us eight subnets (we only need three for the LANs) and each subnet will have up to 30 available host addresses. Can you see how this will fit ACME II requirements?
Subnet | |
128 | √ |
192 | √ |
224 | √ |
240 | |
248 | |
252 | |
254 | |
255 |
If you tick across three places on the top row of the subnetting secrets cheat chart you will see that our subnets go up in increments of 32. Our subnets will be 0,32,64,96 and we can’t use 128 because this is used for the large LAN.
Hosts | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
√ | √ | √ |
So now we have:
LAN Hosts
200.100.100.0/27 – Let’s reserve this for the WAN links
200.100.100.32/27 – LAN 1 (hosts 33-62)
200.100.100.64/27 – LAN 2 (hosts 65-94)
200.100.100.96/27 – LAN 3 (hosts 96-126)
Next. We need IP addresses for three WAN connections. WAN IP addressing is fairly easy because we only ever need 2 IP addresses if it is a point to point link. On the hosts column tick down two places to get 4 and we take 2 away to get 2 hosts. This leaves 6 bits for the subnet.
Powers of 2 | Subnets | Hosts -2 |
2 | √ | √ |
4 | √ | √ |
8 | √ | |
16 | √ | |
32 | √ | |
64 | √ | |
128 | ||
256 | ||
512 |
Tick down 6 places on the subnets column to get 252 as our subnet mask.
Subnet | |
128 | √ |
192 | √ |
224 | √ |
240 | √ |
248 | √ |
252 | √ |
254 | |
255 |
Our Network Addresses
As a network administrator you would keep a record of used IP addresses and subnets. So far you will have allocated the addresses as follows:
WAN Links
200.100.100.0 /30 – WAN link 1 (hosts 1-2)
200.100.100.4 /30 – WAN link 2 (hosts 5-6)
200.100.100.8/30 – WAN link 3 (hosts 9-10)
LAN Hosts
200.100.100.32/27 – LAN 1 (hosts 33-62)
200.100.100.64/27 – LAN 2 (hosts 65-94)
200.100.100.96/27 – LAN 3 (hosts 96-126)
Large LAN Hosts
200.100.100.128/25 – LAN (hosts 129-254)