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 172.16.0.0 with 255.255.0.0 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 255.255.255.128.
Our first subnet will look like this:
172.16.0.0 - network mask
172.16.0.1 - first usable IP
172.16.0.127 - broadcast address
172.16.0.126 - last usable IP
This is the IT department subnet.
The next subnet will have the network address 172.16.0.128. 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 255.255.255.192.
172.16.0.129 first usable IP
172.16.0.191 - broadcast address
172.16.0.190 - last usable IP
I think you got the ideea, I will write the calculations directly for the next subnnets:
2^6=64-2=62 => 32-6=26. network mask /26 or 255.255.255.192
172.16.0.192 - network address
172.16.0.193 - first usable IP
172.16.0.255 - broadcast address
172.16.0.254 - last usable IP
172.16.1.0 - network address
2^4=16-2=14 => 32-4 =28, network mask /28 or 255.255.255.240
172.16.1.1 - first usable IP
172.16.1.15 - broadcast address
172.16.1.14 - 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 http://jodies.de/ipcalc 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.
DDoS Protection – The Case for Businesses - As DDoS attacks continue to rise, Power Admin takes a look at the stats and what can be done to help prevent such attacks damaging your business in 2014 “D...