Wednesday, 26 June 2013

Simple IP Subnetting (with real world scenario illustration)

As commonly assumed by most students pursuing their career in any phase of IP Networking, subnetting - an integral part of efficient network design and management is a herculean task.

Based on this assumption and my fight-to-finish to help people understand and make IP subnetting to be at their beck and call, I have structured out this simple way of getting it over with.


Now, let’s delve into the topic.


To properly understand this topic we have to quickly be reminded of some basics;

A Network – simply, group of interconnected devices communicating and sharing resources on the same segment.


SUBNET – Owing to the definition above, we can simply refer to SUBNET as separate groups of interconnected devices carved out of the already existing one large group.


IP ADDRESS – An IP Address is used to identify individual devices on a network. You can picture it as NAME of a person in a Family. Hence, in a Family everyone must have a name, and the name must be unique. Likewise, in a Network every device (PC etc.) must have a unique IP address.

In order to help you understand the concept, I am going to approach the topic using my hypothetical Family story theory.

Let’s get started;


An IP Address is made of 4 octets or bytes containing 8 bits of information each. This makes the 32bits size of an average IP Address. Also, every IP address is made of TWO portions; Network & Host portions – this is determined by the Subnet mask of that IP Address.

It takes this format:
For the rest of this note, please endeavor to take note of the correlation below:
 
Computer Network
Human Network
Network
Family
Network portion of the IP address
Surname
Host portion of the IP address
First name






Going by my hypothetical family story, there is a Mr. Onifade who has 3 sonsOnifade John, Onifade James, and Onifade Mark. After many years, these 3 sons grew up and gave birth to their own sons too.

Onifade John gave birth to Onifade John Ade and Onifade John Wale

Onifade James gave birth to Onifade James Bade and Onifade James sola

So also, Onifade Mark gave birth to Onifade Mark Mary and Onifade Mark Rose


From the diagram above, we see that everyone on the network has Onifade in a portion of their names, which means they all belong to that network at the 1st level. This level contains the 192.168.X.X network


At the 2nd level we have 3 different sub-networks (SUBNETS) – showing us that the network has been subnetted or in other words sub-divided into 3 groups. This level has the 192.168.10.X, 192.168.11.X, and 192.168.12.X networks.

Simply put, the rule of the thumb is that for computers to know and be able to speak with other computers on the network, they must have some portions of their IP addresses similar, and this similarity is justified by the Subnet Mask.


The Subnet Mask tells the computer or any network device which portions of their IP Address is the Network and which portion is the Host.


The Subnet Mask also state the range or pool of address (network) that device belongs.
  

Having understood my story, I know the question still remains – how really do we subnet?


Ok! Let’s find out…


HOW TO SUBNET

The whole concept of Subnetting is actually the act and art of logically creating more networks from a single network. But before we start digging deep, let’s have a look at a few mathematical concept that we need to be able to effortlessly subnet.


MATHEMATICAL RECALL

I like to bring to your remembrance our little mathematical friend – Binary. Binary is the expression of values in the base 2 (typically, 1s and 0s). As human we have 10 fingers so we easily relate with figures using the base 10.


Now let’s try to bring some devotedness between these two – Binary and Decimal.


Taking 56 for example;

Decimal = 56       -              Binary = 0 0 1 1 1 0 0 0


How is that true?


Recall that 1 byte = 8 bits

That is; 1 byte = X  X  X  X  X  X  X  X


Also recall that to convert a figure from Binary to Decimal and vice versa you have to know this;


So, for 56 the translation looks like this;


For 104, it looks like this;

THE INCREMENT a.k.a BLOCK SIZE

To aid your ability to subnet you have to know this by heart.

The Block size otherwise called Increment is resulting exponential of 2 at every position within the 8 bits of Binary.

And all of the 8 bits when converted to the base 10 sums up to 255. Hence each of the octets of IP address can only be any number between 0 and 255.
Recall that each octet contains 8 bit of data:




Hence the address 192.168.10.1 takes this form;

SUBNET MASK IN BINARY FORM

Since you now understand the IP address from the binary point of view, now let’s see Subnet Mask from a Binary point of view as well.


We have 3 Classes of Default Subnets:

Class A =              255.0.0.0              CIDR= /8

Class B =               255.255.0.0         CIDR = /16

Class C =             255.255.255.0     CIDR = /24


CIDR above means Classless Inter-Domain Routing, and is conceptually the same as VLSM – Variable Length Subnet Mask.


In Subnet Mask 255 represents Network, while 0 represents Host, and when viewed from the binary point of view, 1 is Network while 0 is Host i.e. ;

CIDR NOTATION

This is the simplest part of this topic. This notation is concise way of telling you what the subnet mask of a Network Address looks like.

When you see /24, it simply is telling you that; out of the 32 bits in the IP Address structure, the first 24 counting from the left are “on” which means they are all “1s”.

It’s easy to relate with what happened in the /24 above, but looking at the next item /27, things start getting cloudy         Hey! You, don’t worry, that’s why I’m here!        


Remember that the IP Address format contains 4 Bytes or Octets (x . x . x . x), and that each octet contains 8 bits which can be either 1 or 0.


Also recall that in Subnet Mask, to get the value of an octet you have to get the corresponding value of each bit in decimal and then sum together the decimal value of only the places where the bits are turned “on” (places whose values are 1), as below;


The figure above shows how the value 224 in the 4th octet of the /27 of our previous example was obtained.

If you repeat the process in the figure above then you will find out that that same process led to how other values in the other octets were obtained as well.

Ok!


ART OF SUBNETTING

Since you have grabbed all the information above, let us go into steps to take in order to successfully subnet networks.


STEPS:

·         Know how much networks are needed, and how much hosts per network is required

·         Determine the block size that best fits the host size for your network

·         Increment your network address using the determined block size

·         Ensure you begin your subnetting with the network with the largest number of hosts, and continue in descending order till you get to the finish


REAL WORLD SCENARIO

Company A after several meeting with the heads of department and the CEO has decided that its one large network connecting every departments together should be separated into different sub networks to enforce security and help structure the organization for scalability and other important features.


Company A must use this network address – 192.168.100.0


Company A currently has 5 departments (Admin, Accounts, Sales, Productions and Engineering).

The derived network requirement for Company A goes thus;


From the above description we already have the first information i.e. we already know how many networks are needed – the answer is 5.


So also, each network will have the following number of hosts/users;


Admin                   -              5 hosts

Accounts             -              23 hosts

Sales                      -              45 hosts

Productions        -              12 hosts

Engineering        -              14 hosts


Let us get started;


Remember our Steps:

Starting from the largest, means we’ll have to start with Sales, then Accounts, Engineering, Productions, and Admin.


Starting with Sales….


Recall Block size / Increment
 


The first question you need to ask yourself is; what block size can carry up to 45 hosts?

From above, 32 will be too small but 64 will be ok, although we’ll still have about 17 unused IP addresses but at least we have been able save a lot that would have got wasted if we used a default boundary subnet mask like /24 .


Hence, we’ll increment the given network address number with our selected block size – 64. Another important thing to note is the octet where we’ll be doing the addition, in this case it’s the 4th octet. This will result in the below;


Also, to get the subnet just do the block size addition for every 1s in all octets, for example – 

Sales Subnet Mask looks thus;


1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 . 1 1 0 0 0 0 0 0

       255             .            255        .            255        .           192                     =      /26


NOTE: As described in the figure below, the Network and Broadcast of each address pool are not useable because they are the boundary of the network.


I believe this write up was helpful!

Thank you.


You can see here also: http://adaptiveit.blogspot.com/

No comments:

Post a Comment