Skip to main content

Master your IP Subnetting Skills

In real life scenario we use various free tools to quickly calculate the IP sub-net but if you are preparing for an exam or an interview this is an favorite question asked and we need to be prepared for this question.

To master IP sub-netting you need to keep practicing and follow a simple method which will ease this effort.

The scope is limited just to quickly find the network number or calculate number of host and sub-net as quickly as possible for details you will have to refer other study material.

Magic Number

256 minus <sub-net mask> = magic number.

Example: 
128.0.0.0 256 minus 128= 128 
255.192.0.0 256 minus 192= 64 
255.255.224.0 256 minus 224= 32 
255.255.255.248 256 minus 248= 8 

Figuring out which network a particular host belongs to? 

Take 172.26.180.185  255.255.248.0 for example. 

172.26 we don't worry about, and same with the .185  

Take 256 - 248 = 8 (increments of 8 to be exact) Magic number!!! 

Take 180 divide by 8 = 22.5 All you care about is the whole number here. drop the .5 and multiply 8 X 22 (your whole number) = 176 

176 is your network number. 172.26.176.0. 


Take 172.24.65.168 255.255.255.128 for example. 

172.24.65 we don’t worry about here

Take 256 - 128 =128 (increments of 128 to be exact) Magic number!!! 

Take 168 divide by 128 =1.3125 all you care about is the whole number here. Drop the .3125 and multiply 128 X 1 (your whole number) = 128 

128 is your network number. 172.24.65.128 

What if they give you a slash notation instead of the whole subnet mask?
Take  191.12.180.12 /28 
To figure out the subnet mask we need to figure out what a /28 is 

Take /28 were borrowing 4 bits 1st bit borrowed= 128 
X.X.X.11110000 2nd bit borrowed= 192 
3rd bit borrowed= 224 
128+64+32+16=240 (subnet mask) 4th bit borrowed= 240 
5th bit borrowed= 248 
6th bit borrowed= 252 
7th bit borrowed= 254 
8th bit borrowed= 255 

So we know the IP address is 191.12.180.12  and the subnet mask is 255.255.255.240 

From here follow the above examples:
191.12.180. we don’t worry about Take 256 - 240 mask= 16 (increments of 16 to be exact) Magic number!!! 

Take 12 and divide by 16 = 0.75 all you care about is the whole number here. 

Drop the .75 and multiply 16 (increments) X 0 (your whole number) = 0 
0 is your network number. 191.12.180.0

Take 172.21.98.116 /23 To figure out the subnet mask we need to figure out what a /23 is 

Take /23 were borrowing 7 bits 

1st bit borrowed= 128 
X.X.11111110.0 2nd bit borrowed= 192 
3rd bit borrowed= 224 
4th bit borrowed= 240 
5th bit borrowed= 248 
6th bit borrowed= 252 
128+64+32+16+8+4+2=254 (subnet mask 7th bit borrowed= 254 
8th bit borrowed= 255 

So we know the ip address is 172.21.98.116 and the subnet mask is 255.255.254.0 

From here follow the above examples 
172.21. we don’t worry about, and the same with 116 

Take 256 - 254 mask= 2 (increments of 2 to be exact) Magic number!!! 
Take 98 and divide by 2= 49 all you care about is the whole number here. 

multiply 2 X 49 (your whole number) = 98 
98 is your network number. 172.21.98.0. 

Figuring out how many subnets and hosts per subnet can you get from a network. 
Take 192.168.95.0/27 for example 
We know a 192.X.X.X address is a class C address. Or in this case 24 bits. (classful). 
Class A 0-126, or 8 bits example 124.X.X.X 
Class B 128-191, or 16 bits example 128.X.X.X 
Class C 192-223, or 24 bits example 192.X.X.X 

To figure subnets 
So take the slash notation were given of /27 minus it from the number of bits in our classful IP address 24 - 27 =3 (remaining bits) this gives us 2^3=8 (Number of subnets). 

 To figure out hosts 
So take the slash notation were given of /27 minus it from the number of bits in an Ipv4 address 32-27=5 (remaining bits) this gives us 2^5=32 - 2=30(number of usable hosts). 

For the network 192.168.5.0 /27 you have 8 subnets, and 30 hosts 

Take 128.23.14.0/28 for example 
We know a 128.X.X.X address is a class B address. Or in this case 16 bits. (classful). 

 To figure subnets 
So take the slash notation were given of /28 minus it from the number of bits in our classful IP addresss 16-28 = 12 (remaining bits) this gives us 2^12=4096 (Number of subnets). 

 To figure out hosts 
So take the slash notation were given of /28 minus it from the number of bits in an Ipv4 address 32 -28 = 4 (remaining bits) 

This gives us 2^4=16 - 2=14(number of usable hosts). 

For the network 128.23.14.0 /28 you have 4096 subnets, and 14 hosts. 

Don’t let exponents fool you (2^x). It’s not as hard as they seem. 
Take 2^10 for example 
You will always start with the number 2 double the number until you reach the second number 
2 (1st time) 
4 (2nd time) 
8 (3rd time) 
16 (4th time) 
32 (5th time) 
64 (6th time) 
128 (7th time) 
256 (8th time) 
512 (9th time) 
1024 (10th time) 

So we took the number 2 and doubled it 10 times for the number 1024. 

Take 2^6 for example 
2 (1st time) 
4 (2nd time) 
8 (3rd time) 
16 (4th time) 
32 (5th time) 
64 (6th time) 

2^6=64 

So we took the 2 and doubled 6 times for the number 64 

The main key to subnetting is practice, practice, practice. A great web site to practice is 
http://www.subnettingquestions.com. 

Comments

Popular posts from this blog

MTBF MTTR MTTD

Cisco ASA on GNS3

My struggle for installing Cisco ASA on GNS3 lead me to write this procedure which is already floating around in various versions around the internet but this attempt was to write a concise and still informative  procedure to configure Cisco ASA successfully on GNS3. The relevant snapshots will be updated shortly  :-)