VLSM
VLSM
VLSM
Variable Length Subnet Masking - VLSM - is a technique that allows network administrators to divide an IP address space into subnets of different sizes, unlike simple samesize Subnetting. Variable Length Subnet Mask (VLSM) in a way, means subnetting a subnet. To simplify further, VLSM is the breaking down of IP addresses into subnets (multiple levels) and allocating it according to the individual need on a network. It can also be called a classless IP addressing. A classful addressing follows the general rule that has been proven to amount to IP address wastage. Before you can understand VLSM, you have to be very familiar with IP address structure. The best way you can learn how to subnet a subnet (VLSM) is with examples. Lets work with the diagram below:
Looking at the diagram, we have three LANs connected to each other with two WAN links. The first thing to look out for is the number of subnets and number of hosts. In this case, an ISP allocated 192.168.1.0/24. Class C
HQ = 50 host RO1 = 30 hosts RO2 = 10 hosts 2 WAN links We will try and subnet 192.168.1.0 /24 to sooth this network which allows a total number of 254 hosts I recommend you get familiar with this table below. I never leave home without it!
Lets begin with HQ with 50 hosts, using the table above: We are borrowing 2 bits with value of 64. This is the closest we can get for 50 hosts.
HQ - 192.168.1.0 /26 Network address HQ = 192.168.1.1 Gateway address 192.168.1.2, First usable address 192.168.1.62- Last usable address. Total address space -192.168.1.2 to 192.168.1.62 192.168.1.63 will be the broadcast address (remember to reserve the first and last address for the Network and Broadcast) HQ Network Mask 255.255.255.192 - we got the 192 by adding the bit value from the left to the value we borrowed = 128+64=192 HQ address will look like this 192.168.1.0 /26
RO1 = 30 hosts We are borrowing 3 bits with value of 32; this again is the closest we can get to the number of host needed. RO1 address will start from 192.168.1.64 - Network address Now we add the 32 to the 64 we borrowed earlier = 32+64 = 96
RO1 = 192.168.1.65 Gateway address 192.168.1.66 - First usable IP address 192.168.1.94 - Last usable IP address 192.168.1.95 Broadcast address total address space 192.168.1.66 192.168.1. 94 Network Mask 255.255.255.224 I.e. 128+64+32=224 or 192.168.1.64/27
RO2 = 192.168.1.96 Network address We borrow 4 bits with the value of 16. Thats the closest we can go. 96+16= 112 So, 192.168.1.97- Gateway address 192.168.1.98 - First usable address 192.168.1.110 - Last usable address 192.168.1.111 broadcast Total host address space 192.168.1.98 to 192.168.1.110 Network Mask 255.255.255.240 or 192.168.1.96 /28
WAN links = we are borrowing 6 bit with value of 4 =112 + 4 =116 WAN links from HQ to RO1 Network address will be 192.168.1.112 /30 : HQ se0/0 = 192.168.1.113 RO1 se0/0= 192.168.1.114 Mask for both links= 255.255.255.252 ( we got 252 by adding the bits value we borrowed i.e 124 +64 +32 +16+ 8 +4=252
WAN Link from HQ to RO2 Network address = 192.168.1.116 /30 HQ = 192.168.1.117 subnet mask 255.255.255.252
As
I mentioned earlier, having this table will prove very helpful. For example, if you have a subnet with 50 hosts then you can easily see from the table that you will need a block size of 64. For a subnet of 30 hosts you will need a block size of 32.
Longest Match Algorithm All routers must implement a consistent forwarding algorithm based on the "longest match" algorithm. The deployment of VLSM means that the set of networks associated with extended-network-prefixes may manifest a subset relationship. A route with a longer extended-network-prefix describes a smaller set of destinations than the same route with a shorter extended-network-prefix. As a result, a route with a longer extended-network-prefix is said to be "more specific" while a route with a shorter extended-network-prefix is said to be "less specific." Routers must use the route with the longest matching extended-network-prefix (most specific matching route) when forwarding traffic. For example, if a packet's destination IP address is 11.1.2.5 and there are three network prefixes in the routing table (11.1.2.0/24, 11.1.0.0/16, and 11.0.0.0/8), the router would select the route to 11.1.2.0/24. The 11.1.2.0/24 route is selected because its prefix has the greatest number of corresponding bits in the Destination IP address of the packet. Destination 11.1.2.5 = 00001011.00000001.00000010.00000101
* Route #1 11.1.2.0/24 = 00001011.00000001.00000010.00000000 Route #2 11.1.0.0/16 = 00001011.00000001.00000000.00000000 Route #3 11.0.0.0/8 = 00001011.00000000.00000000.00000000 * Best Match is with the Route Having the Longest Prefix (Most Specific)
There is a very subtle but extremely important issue here. Since the destination address matches all three routes, it must be assigned to a host which is attached to the 11.1.2.0/24 subnet. If the 11.1.2.5 address is assigned to a host that is attached to the 11.1.0.0/16 or 11.0.0.0/8 subnet, the routing system will never route traffic to the host since the "longest match algorithm" assumes that the host is part of the 11.1.2.0/24 subnet. This means that great care must be taken when assigning host addresses to make sure that every host is reachable! Where you would use VLSM ? For example, in a campus environment. You might have a Class B block of addresses to be used across several campuses. One of the campuses requires half of the addresses and the other two need a fourth. So you use variable length subnets. Within each campus, there are several buildings, so you further subnet the subnets. And in those buildings you could have workgroups, which require subnets of the subnets of the subnets. All these entities require different numbers of IP addresses. To use fixed subnet masks, where all would receive the same number of IP addresses, would be very wasteful. VLSM Route Aggregation VLSM is simlilar to CIDR, in that is performs route aggregation. The ISP applies CIDR to reduce the number of routes that must be stored. Similarly, the customer applies VLSM to their LAN to optimize usage of their alloted address space. They do not create any new addresses - but they can group them more efficiently. The difference is that with CIDR, the ISP or Internet Registry agregates smaller variablelength address blocks into one larger block and with VLSM the end organization aggregates smaller variable-length address blocks into their larger, assigned address block. You may be thinking . . . "wait a minute . . . CIDR is supernetting and VLSM is subnetting". Actually, VLSM uses subnet masks, but the purpose is to combine them into a larger network address - a supernet !! Both CIDR and VLSM perform supernettinf, or route aggregation.
But the similarity stops there - with aggregation. CIDR goes a lot farther - it includes the complex formula for routing classless packets across the Internet backbone. VLSM is not concerned with routing, and it is not concerned with either classless or classful. It is only a method of using variable length subnet masks to allow variable length subnets to exist, and to be combined into one larger network address. This allows networks to use different subnet masks of varying lengths, so that the address space can be more fully used. For example, a company may have several mid-size groups and then several smaller groups all on different network segments. VLSM could be used to give the mid-size segments /24 subnets and the smaller segments /27 subnets. All of the smaller subnets are combined into the larger subnets, and all the routes are agrregated as shown in the following diagram:
Example -
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: