VLSM and our next topic, summarization builds up on subnetting. If you still have doubts on subnetting, I would strongly suggest you devote some more time to it and practice before moving ahead. You also may want to consider picking up our 100 page How & Why We Subnet Workbook. This workbook walks you through over 60 examples to help you really understand the ins and outs of subnetting.
Figure 2-1 Classful Network
Earlier, it was required to use the same subnet mask across the network. This was called classful networking. With increase in complexity of networks and decrease in available IP addresses it became obvious that classful networking causes waste valuable of IP addresses. To understand how, consider Figure 2-1. The largest subnet requires 30 host addresses. So across the network a mask of /27 is used, which gives 30 hosts per subnet. You will notice that in every subnet except the subnet attached to RouterD, some host addresses will remain unused. In particular, 28 host addresses are wasted for each link between the routers. In total this network wastes 118 addresses and uses 92 addresses.
To avoid wasting of IP addresses, classless networking was introduced by way of VLSM. VLSM allows you to use different subnet masks across the network for the same class of addresses. For example, a /30 subnet mask, which gives 2 host addresses per subnet, can be used for point-to-point links between routers. Figure 2-2 shows how VLSM can be used to save address space in the network shown in Figure 2-1.
Figure 2-2 Classless Network with VLSM
In Figure 2-2, notice the different masks used for each subnet. The first network with 13 hosts is using a mask of /28, which gives 16 hosts addresses. The point-to-point links between the routers are using a /30 mask which gives 2 host addresses. In total the network is still using 92 addresses but is wasting only 22 addresses. Now that you know the benefit of VLSM, take a look at how you can use it in a network.
There are a few restrictions you need to consider when planning to use VLSM:
- You need to use routing protocols that support classless routing such as Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), Border Gateway Protocol (BGP) or Routing Information Protocol (RIP) version 2. Classful protocols such as RIPv1 cannot be used with VLSM. While routing protocols are covered in detail in Chapter 4, you should understand that a routing protocol is classful because it does not advertise the subnet mask along with the network address in its updates. Hence, routers running these protocols, do not know the subnet mask and strictly follow the class of the network. Classless protocols on the other hand advertise and understand subnet masks.
- You need to use fixed block sizes. You have come across these block sizes during subnetting practice and these are listed in Table 2-9. You cannot use any block sizes apart from these. For example in Figure 2-2, for the networks connected to RouterB and RouterC, a block size of 32 was used even though the total addresses required were 21 in each subnet.
Table 2-9 Block Sizes for VLSM
Block Size | Host addresses available |
128 | 126 |
64 | 62 |
32 | 30 |
16 | 14 |
8 | 6 |
4 | 2 |
When designing a network using VLSM, the following simple steps can help come up with an appropriate addressing scheme:
- Start by finding the largest subnet in your network. The number of host addresses needed decides the size of the subnet.
- Next assigning an appropriate mask to the largest subnet using the block sizes mentioned in Table 2-9.
- Note the subnet numbers remaining with the mask used in Step 2.
- Take the next available subnet and subnet it further to accommodate your smaller subnets.
- Write down your new subnet numbers again.
- Repeat step 4 and 5 for smaller segments.
Consider the example shown in Figure 2-2 and work through the above steps to see how the network address and subnet mask was found for each segment:
- The largest segment in Figure 2-2 is attached to RouterD. It requires 30 host addresses, including the router interface (29 host addresses and 1 router interface). So we can use a /27 mask which gives us exactly 30 host addresses. We assign 192.168.1.0/27 to that subnet.
- Our new subnets using /27 mask are 192.168.1.0/27, 192.168.1.32/27, 192.168.1.64/27, 192.168.1.96/27, 192.168.1.128/27 etc.
- Next we look at the smaller subnets. The subnets attached to RouterB and RouterC require 21 host addresses (20 host addresses and 1 router interface). The block size we can use for them is 32. We already have subnets available with /27 mask, so we simply assign them to these segments – 192.168.1.32/27 and 192.168.64/27.
- Our next smaller segment is the one attached to RouterA. It requires 14 host address, so a block size of 16 or a mask of /28 can be used. So we take the next available subnet, 192.168.1.96/27 and subnet it further using a /28 mask. This gives us 192.168.1.96/28 and 192.168.1.112/28. We assign the first of these to this segment – 192.168.1.96/28.
- Finally we have the three point-to-point segments between the routers. Each requires 2 host addresses hence a block size of 4 and a mask of /30. We take our available subnet – 192.168.1.112/28 and subnet it further using a mask of /30. This gives us 192.168.1.112/30, 192.168.1.116/30, 192.168.1.120/30 and 192.168.1.124/30. We use the first three for these segments – 192.168.1.112/30, 192.168.1.116/30 and 192.168.1.120/30.
Consider Figure 2-3 as another example. Using a class C network of 192.168.10.0/24 design a VLSM solution to accommodate host requirements of all the segments.
Figure 2-3 VLSM – Example #2
To design the VLSM solution, follow the 5 steps discussed earlier:
- The largest segment requires 125 host addresses. So a mask of /25 can be used. This gives two subnets – 192.166.10.0/25 and 192.168.10.128/25. The first subnet can be assigned to this segment.
- The second largest segment requires 60 host addresses. You can take the second available subnet – 192.168.10.128/25 – and divide it further using a /26 mask to give you subnets 192.168.10.128/26 and 192.168.10.192/26. Assign the first one to this segment.
- The third largest segment requires 29 host addresses (28 host addresses and 1 for the router interface). You will need to use a block of 32 and a mask of /27. Take the remaining subnet from the previous step and divide it further using a /27 mask. This will give you subnets 192.168.1.192/27 and 192.168.1.224/27. Assign the first one to this segment.
- The fourth largest block requires 13 host addresses (add one for the router interface). You can use a block of 16 and a mask of /28. Take the remaining subnet from the previous step and divide it further using a mask of /28. This will give you subnets 192.168.1.224/28 and 192.168.1.240/28. Assign the first one to this segment.
- Now you are left with 3 point-to-point links between the routers. These links require two host addresses and a mask of /30. Take the remaining subnet from the previous step and divide it using a mask of /30. This will give you subnets 192.168.1.240/30, 192.168.1.244/30, 192.168.1.248/30 and 192.168.1.252/30. Use the first three of these for the point-to-point links. The remaining one subnet can be left for future use.
Figure 2-4 shows the solution derived in the above steps.
Figure 2-4 VLSM – Solution for Example #2