Saturday, February 18, 2017

IP Subnetting – The easy way

IP Subnetting – The easy way


Is network subnetting driving you crazy ? Does binary math gives you headaches ? well..fear not, since the time i have delved into networks, i have gone through all the oohs and aaahs and the NAH’s of the logical crescendo , and I present you the easiest way to do subnetting. Generally,3 questions are being addressed when subnetting an IP- IP subnetting made easy - prohack

  1. No of subnets
  2. No of valid hosts and
  3. Host range/block size

We will tackle them one by one. First you need to know about IP addresses and their classes.

Class A includes 0-127 where 0 and 127 are reserved, the default subnet mask for this class is /8 .

Class B includes 128-191 in their first octet, and the default subnet mask for this class is /16

Class C deals with 192-224 in their first octet and the default subnet mask for this class is /24

Also, also, understand a simple concept, subnet masks lying between 8- 15 are A class masks, from 16- 23 are B class and 24-32 are C class masks. Furthermore, a subnet mask can be expressed as this where (N)etwork value and (H)ost values-

Class A : 255.0.0.0   = NNNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH  
Class B : 255.255.0.0 = NNNNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH 
Class C : 255.255.0.0 = NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
Class mask value          8        16        24        32

Now once you see it, lets tackle some real life questions. Lets find the no of subnets and valid hosts for 192.168.10.10/18

See this ? its a C class IP address having a mask of B class (as the mask lies between 16-24) now, in order to find the number of subnets, use the following formulae - 

2 ^ (What mask you have been provided – default mask of the IP address given)

putting the values here..

2^(18-16) –>  2^(2) –>  4 subnets

simple : )

Now for calculating the no.of hosts, use the below formulae -

2^(32- what mask you have been provided) –2

Putting values here..

2^(32-18)-2 -> 2^(14)-2 –> 16384-2 –> 16382 hosts

piece of cake ..

now to find the block size, see the provided mask lies between which next default mask value , which in this case is 24 (as 18 is greater than 16 and less than 24) . So ..

Subtract the provided mask with the class mask value which is greater than it.

2^(Next class mask value – provided mask)

which on putting values will be

2^(24-18) –> 2^6 –> 64

So, the block size will be of 64 . So, the IP addresses will be divided into 4 subnets (which we already calculated above) above as -

192.168.0.0 - 192.168.63.255

192.168.64.0 – 192.168.127.255

192.168.128.0 - 192.168.191.255

192.168.192.0 – 192.168.255.255

And the best part, its applicable to all classes : )

 

Happy Subnetting : ]


Available link for download