Nov 14, 2007

Variable Length Subnet Masks

Many people have heard of subnetting. Infact, if you work in the IT industry, it is a requirement to have some understanding of subnetting, or at the very least know how to use a subnet calculator. If you don't know about subnetting, I posted an interesting video about it here a few months back: (Subnetting Video)

There is a drawback to standard subnetting, and that drawback is wasted IP addresses. What do I mean by wasted IP addresses. Lets say you have 5 networks. On network 1 you have 60 hosts, on network 2 you have 40 hosts, on network 3 (WAN) you only have two hosts, on network 4 you have 25 hosts, and finally on network 5 you have 17 hosts. (See my crude diagram below)

Let's make this easy, and use a class C address scheme...Oh wait we can't, because if we allow for 62 hosts per subnet, that only leaves us with 4 networks. We can do a class B address scheme and get everything done with a 26 bit subnet mask (I used to figure this out). That leaves us with 62 hosts per network, but then also leaves us with 1019 unused networks, and times that by 62 hosts per subnet and we now have 63,178 unused IP addresses. Not to mention the unused addresses in the networks we are using.

Lets break it down a different way, lets break it down by networks instead of hosts. The minimum number of networks we can subnet out is 8 in order to fit in our 5. With that, using the same class B scheme, that allows for 8190 hosts per subnet! That too is a huge waste of IP addresses!

So what are you supposed to do if you don't want to waste IP addresses? One solution is to use a Variable Length Subnet Mask or VLSM. This method allows us to only allocate the addresses we need to the hosts that need them with minimal waste. Have I lost you yet?

If you have never heard of it, Wikipedia says VLSM is used to, "allocate IP addresses to subnets according to individual need, rather than some general network-wide rule. Thus the network/host division can occur at any bit boundary in the address. The process can be recursive, with a portion of the address space being further divided into even smaller portions, through the use of masks which cover more bits."

I will not go into how to calculate VLSM, because frankly it is a little more in depth than I really want to get into. If you want to know more about how to figure it out, I found an interesting article about it here: (VLSM How-To). Also, I found a simple online VLSM calculator here: (VLSM Calculator).

With the scenario above, we can get away with using our original class C address scheme. By assigning only enough addresses on for the number of hosts on each network, we can now minimize the waste of IP addresses dramatically.

I will admit that many of us don't really care about wasting an IP address or two, or even a few hundred. I mean most of us are subnetting internal private IP addresses so wasting them isn't too big a deal. Also, what about scalability? You will want the ability to grow too. However, If you are paying for these IP addresses, and wasting them using standard subnetting, then it can become a pretty big deal very quickly, especially since there are limited IP addresses in IPv4.

Once IPv6 becomes the standard, we won't have to worry about tricks like these to conserve numbers, at least not for a long time.

Click Here fo Cool bauer-Power Gear!

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam