**Introduction to Networking** Variable Length Subnet Masking (VLSM)

**What do you know?** • Do you know how to convert decimal numbers to Base2 numbers and vice versa? • Do you know what a subnet is? • Do you know what VLSM stands for and what it is? • Do you know how to perform the VLSM process to devise a logical network scheme? *** Richard Hancock - 2010

**Objectives** • Be able to describe what subnetting is and what it’s benefits are • Be able to define VLSM and describe what it does • Be able to describe the advantages of VLSM • Be able to perform VLSM operations on given IP addresses *** Richard Hancock - 2010

**Subnetting** • The process of dividing a network up into subnets and to assign each subnet a valid network IP address, and the hosts on that subnet valid IP addresses Subnet 2 Subnet 1 Subnet 3

**Subnet benefits** • Makes larger networks more manageable • Reduces bandwidth consumption as a router must forward packets between subnets • Can provide a level of security in the network • But most importantly, it allows you to preserve your IP address allocation and use it more efficiently and effectively *** Richard Hancock - 2010

**Types of subnetting** • There are two types of subnetting: • Classful • Classless (VLSM) • Classful subnetting is used in older network protocols and has various issues that reduce it’s effectiveness • Classful subnetting would not allow you to use Subnet Zero • Classless subnetting (VLSM) is a more efficient system to preserve IP addresses and is used in modern routing protocols • Classless subnetting allows you to use Subnet Zero *** Richard Hancock - 2010

**Some rules** • You cannot use the Network address or the Broadcast address as a host address in either Classful or Classless subnetting! • Once a subnet address is allocated to a subnet with it’s subnet mask it cannot be used for subnetting again *** Richard Hancock - 2010

**Variable Length Subnet Masks** • More than one subnet mask 172.80.40.0 172.80.40.1 – 47.254 172.80.32.0 172.80.32.1 – 39.254 172.80.24.0 172.80.24.1 – 31.254 172.80.8.0 172.80.8.1 – 15.254 172.80.16.0 172.80.16.1 – 23.254 Richard Hancock - 2010

**We need** • An IP address to perform VLSM on • The number of segments we want to divide the major network into • The number of hosts involved in each part of each segment *** Richard Hancock - 2010

**Example using a Class C network address** 192.168.1.0 60 hosts No subnet mask 120 hosts No subnet mask 30 hosts No subnet mask Richard Hancock - 2010

**Process** • Find the segment with the largest number of hosts connected to it • Find an appropriate subnet mask for the largest segment • Write down the subnet addresses to fit the subnet mask • Take one of the newly created subnet addresses and apply a new subnet mask to it that is more appropriate • Write down the subnet addresses to fit the new subnet mask • Repeat from step 4 for smaller segments Richard Hancock - 2010

**Step 1** • Find the segment with the largest number of hosts connected to it • In the example the largest segment has 120 hosts connected so we must start with this segment • How many bits would we need to make 120? • To accomodate120 hosts we need to use 7 bits from the host portion of the address (27 - 2 = 126) 60 hosts 120 hosts 30 hosts Richard Hancock - 2010

**Step 2** • Find an appropriate subnet mask for the largest segment • If we have borrowed 7 bits for our hosts the subnet mask (in binary) will be 11111111.1111111.1111111.1000000 • What is 11111111.11111111.11111111.10000000 expressed in base10? • Converted to decimal (base10) we get 255.255.255.128 Richard Hancock - 2010

**Step 3** • Write down the subnet addresses to fit the subnet mask • Now we need to find the subnet addresses that this subnet mask will create • Use the formula (256 - the subnet mask) • 256 – 128 = 128 • Therefore the subnets would be • 192.168.1.0 and • 192.168.1.128 • We can now assign 192.168.1.0/25 to accommodate the 120 segment • 192.168.1.128 can be used for further subnetting for the other two segments Richard Hancock - 2010

**So far...** 60 hosts (62 in total) No subnet mask 120 hosts (126 in total) 192.168.1.0/25 30 hosts (30 in total) No subnet mask Richard Hancock - 2010

**Step 4** • Take one of the newly created subnet addresses and apply a new subnet mask to it that is more appropriate • We still have two segments to deal with and we have a new subnet address to work with of 192.168.1.128 • We must start with the larger segment, which has 60 hosts • To accommodate 60 hosts we need to borrow 6 bits from the host portion of the given IP address • 26 – 2 = 62 hosts • This will give us a subnet mask of 1111111.1111111.1111111.11000000 • Converted to decimal this will be? • 255.255.255.192 60 hosts (62 in total) Done 30 hosts (30 in total) Richard Hancock - 2010

**Step 5** • Write down the subnet addresses to fit the new subnet mask • Now we need to find the subnet addresses that this subnet mask will create • 256 – 192 = 64 • Therefore the new subnet addresses would be • 192.168.1.128 and • 192.168.1.192 • We can now use 192.168.1.128/26 for the segment with 60 hosts • We have 192.168.1.192 left over to further subnet Richard Hancock - 2010

**So far...** 60 hosts (62 in total) 192.168.1.128/26 120 hosts (126 in total) 192.168.1.0/25 30 hosts (30 in total) No subnet mask Richard Hancock - 2010

**Step 4 is repeated** • Take one of the newly created subnet addresses and apply a new subnet mask to it that is more appropriate • We still have the segment with 30 hosts to deal with • We work this out in the same way as before • To accommodate 30 hosts we need to borrow 5 bits from the host portion of the IP address • 25 – 2 = 30 hosts • This will give us a subnet mask of 1111111.1111111.1111111.11100000 which is 255.255.255.224 Richard Hancock - 2010

**Step 5 is repeated** • Write down the subnet addresses to fit the new subnet mask • Now we need to find the subnet addresses that this subnet mask will create • 256 – 224 = 32 • Therefore the new subnet addresses would be 192.168.1.192 and 192.168.1.224 • We can now use 192.168.1.192/27 for the segment with 30 hosts • We still have the new 192.168.1.224 subnet which could be used for future growth Richard Hancock - 2010

**Result!** 192.168.1.0 60 hosts (62 in total) 192.168.1.128/26 120 hosts (126 in total) 192.168.1.0/25 30 hosts (30 in total) 192.168.1.192/27 Richard Hancock - 2010

**Exercise 1** • 192.168.2.0/24 • 7 remote sites, 30 hosts each • P to P links between routers Remote A 30 hosts Remote B 30 hosts Remote C 30 hosts Remote D 30 hosts Central Remote E 30 hosts Remote F 30 hosts Remote G 30 hosts Richard Hancock - 2010

**Exercise 1 solution** Remote hosts • 25 – 2 =30 hosts • 11111111.11111111.1111111.11100000 (255.255.255.224) • 256 – 224 = 32 • 192.168.2.0/27 (assigned to segment) • 192.168.2.32/27 (assigned to segment) • 192.168.2.64/27 (assigned to segment) • 192.168.2.96/27 (assigned to segment) • 192.168.2.128/27 (assigned to segment) • 192.168.2.160/27 (assigned to segment) • 192.168.2.192/27 (assigned to segment) • 192.168.2.224/27 (left for further subnetting) • Eight subnets created. • First seven give to remote sites; eighth subnet re-subnetted to accommodate the P to P links. Richard Hancock - 2010

**Exercise 1 solution continued** P to P links • 22 – 2 = 2 hosts • 11111111.11111111.11111111.11111100 (255.255.255.252) • 256 – 252 = 4 • 192.168.2.224/30 (assigned to segment) • 192.168.2.228/30 (assigned to segment) • 192.168.2.232/30 (assigned to segment) • 192.168.2.236/30 (assigned to segment) • 192.168.2.240/30 (assigned to segment) • 192.168.2.244/30 (assigned to segment) • 192.168.2.248/30 (assigned to segment) • 192.168.2.252/30 (expansion) • Eight subnets created supporting 2 IP addresses • Only seven subnets are needed, leaving one left over for expansion. Richard Hancock - 2010

**Exercise** • 192.168.3.0 30 hosts 6 hosts Backbone 126 hosts 6 hosts 30 hosts 6 hosts 30 hosts Richard Hancock - 2010

**Exercise 2 solution** Backbone 27 – 2 = 126 11111111.1111111.11111111.10000000 (255.255.255.128) 256 – 128 = 128 192.168.3.0 /25(assigned to backbone) 192.168.3.128/25 30 Hosts 25 – 2 = 30 11111111.11111111.11111111.11100000 (255.255.255.224) 256 – 224 = 32 192.168.3.128/27 (assigned to segment) 192.168.3.160/27 (assigned to segment) 192.168.3.192/27 (assigned to segment) 192.168.3.224/27 6 hosts 23 – 2 =6 11111111.11111111.11111111.11111000 (255.255.255.248) 256 – 248 = 8 192.168.3.224/29 (assigned to segment) 192.168.3.232/29 (assigned to segment) 192.168.3.240/29 (assigned to segment) 192.168.3.248/29 (expansion) Richard Hancock - 2010

**Summary** • Classless subnetting (VLSM) is used in most networks and uses modern routing protocols • Subnetting is all about • Preserving IP addresses • Making large networks more manageable (logically) • Preserving bandwidth • Providing a level of security • To determine the number of hosts a subnet can support use the formula 2n – 2 • Always start the VLSM process with the segment with the largest amount of hosts to accommodate • You cannot use the subnet address or broadcast address as a host address Richard Hancock - 2010

**Questions...** • ...are there any? Richard Hancock - 2010

**End!** Richard Hancock - 2010