Routing Protocols - CIDR and VLSM

   We spoke in a past article about the IP classes that were invented for the Internet Protocol version 4. Because the Internet expanded so fast , IP addresses became fewer and fewer, this is why different techniques were invented to reduce the IP pool utilization. When IPs were categorized, three main classes were used A, B and C with /8, /16 and /24 network mask. Before VLSM and CIDR were invented, companies that wanted to connect to the Internet, received a whole classful network address. This mechanism was not feasible because IP addresses were wasted (companies used only a small portion of the assigned classful network address).
   When classful routing is used, all devices in the network share the same prefix, this is why network mask is not send in the routing messages. In this situation, routers determine the network portion by looking at the first bits of the IP address. Class A has the first bits set to 0000, class B 1000, class C 1100, Multicast 1110 and Experimental class 1111. CIDR or Classless Inter-Domain Routing was invented to address the classful routing limitations. In classless routing, network masks are sent in the routing update messages. Because of this, the network portion is determined by the network mask and not by the IP class. CIDR uses IP addresses more efficient (IPs are not wasted) and is successfully used to reduce the routing tables size. CIDR uses VLSM or Variable Length Subnet Masks to allocate IP addresses. When classfull routing was used, companies received a whole class of IP addresses even if they only needed several IPs. With CIDR, companies receive only the number of IPs they really need and use. Another good aspect of CIDR is that you can summarize networks and announce them by only one IP. The Classless routing protocols that we will study are: Ripv2, EIGRG and OSPF. These dynamic routing protocols send network masks in the routing messages. To understand how they work we will first talk about the RIPv1 to see the contrast between a classful and a classless protocol.
   We will take a subnetting example in a network that uses different subnet masks, in order to understand the VLSM mechanism. Imagine you have to implement a network in a company with many departments that use different number of workstations. Let's take the following scenario:
In our network we need the following:
125 IPs for the IT department
10 IPs for the QA department
35 IPs for the Financial department
and 50 for the Management department.
To start subneting, we need to choose a starting network address and a mask, I will take with or /16 mask.
We need to sort all IPs with the biggest number first, in our case this will be 125, 50, 35, 10. Now we need to calculate the network mask for each department. To do this we need to calculate which number that is a power of 2 will fit our required IP range. We've talked in a previous post about the power of two numbers that are used to subnet.
2^10=1024 and so on.
For our first subnet of 125 IPs, we will need to use 2^7 (128-2=126, we subtract two, because the network and the broadcast IPs are not used by hosts). Now we need to subtract 7 from 32 (the maximum prefix number), 32-7=25. This is our network mask /25 or
Our first subnet will look like this: - network mask - first usable IP

172.16.00000000.0 0000000
172.16.00000000.0 1111111 - broadcast address - last usable IP
This is the IT department subnet.

The next subnet will have the network address We will need to calculate the prefix in the same manner: 50 IPs means that we will use 2^6 (64-2=62). Now, 32-6=26. Our network mask will be /26 or first usable IP 000000 111111 - broadcast address - last usable IP
I think you got the ideea, I will write the calculations directly for the next subnnets:

35 IPs
2^6=64-2=62 => 32-6=26. network mask /26 or - network address - first usable IP 000000 111111 - broadcast address - last usable IP

10 IPs - network address
2^4=16-2=14 => 32-4 =28, network mask /28 or - first usable IP 0000 1111 - broadcast address - last usable IP
  That is all for our VLSM example, we have calculated all the needed subnets. You should try many examples to get the concept and you should use a IP calculator tool to verify your results. For verifying my calculations, I usually use and I would recommend it to anyone.
   That is all for today, I hope you will understand the concept of subneting with VLSM, after reading this post. If you have any questions please feel free to comment, have a wonderful day.
If You Enjoyed This, Take 5 Seconds To Share It



  2. thank you very much :). have a nice day

  3. Your article is very informative and the use of graphics adds to understanding the process.
    Phone Solutions

  4. This is very good article and well explanation. Thumb up.