Tuesday, December 11, 2012

An easier way of subnetting

Here’s a way of learning subnetting that I’ve come up with:
You should know this:
Class A Address: 8 network bits - 24 host bits; range is 0-127 in the first octet
Class B Address: 16 net bits - 16 host bits; range is 128-191 in the first oct
Class C Address: 24 net bits - 8 host bits; range is 192-223 in the first oct
Now, remember this golden rule:
1 - 128
2 - 64
3 - 32
4 - 16
5 - 8
6 - 4
7 - 2
8 - 1
As long as you remember this (very easy) rule, you should be able to answer most subnetting questions in flash.

First part is the number of Host bits and the second part is the ‘increment’.
Let’s take the third line, 3 - 32.
This means, if the number of host bits is 3, you should increment the subnet by 32.
Let me elaborate: - what subnet should this be in?
This is all you need to do:
27-24 = 3 (since this is a class C address, you subtract 24 network bits from 27 and that gives you 3 host bits)
3 should correspond to 32 (according to the golden rule I gave you above)
that means increment is 32
so the subnet range should be:
and so on…
the address given to us is, so that’ll fall in subnet (as 46 lies between 32 and 64)
Here’s another example.
Again, class C address. So this is what you do: 28-24=4
Golden rule: 4 corresponds to 16, so 16 should be the ‘increment’.
So here we go:
and so on…
our address has the last octet value of 50, which lies in the range 48 - 64, so the address is in the subnet.
Let’s try a Class B example now:
What subnet does host belong to?

Its a class B address so this is what we do: 20 - 16 = 4
4 should correspond to 32 going by the golden rule, so increment value is 32 here.
Since it’s a class B address, here’s how we can break the bits into Network and Host bits:
Typical Class B address: 8 Net bits - 8 Net bits (16) - 8 Host bits - 8 Host bits (16)
This example: 8 Net bits - 8 Net bits - 4 Host bits - 0 Host bits (we only have 4 Host bits, remember? 20-16 = 4)
So the increment would be in 3rd octet.
Here we go: and so on..
Third octet in this example is 12, so it should lie in the first address (between 0 and 16):

If you’re preparing for a CCNA exam, this rule should help a lot, as you can easily remember it and after some practice, these values do get embedded in your brain. Saves you a lot of time.
If the Subnet mask has been provided in dotted format, just subtract the first non-zero octet value from right by 256 and that’ll give you the ‘increment’ value.
All you do is: 256-240 = 16. 16 is your increment value!
Another example,
All you do is: 256-248=8. 8 is your increment value and here’s what the subnets should look like: and so on..
Hope this helps. Cheers!

Number of subnets and hosts

I'd like to share with you a method that I use to find how many subnets and hosts per subnet you can get from a given mask. This is the fastest way of calculating and mostly you should be able to do it in your head!

How many subnets?

2^(Total bits - Network bits) = Number of subnets

How many hosts per subnet?
2^(32-Total bits) - 2 = Number of hosts per subnet

Best way of explaining anything is with an example, so let's begin.

Example: How many subnets and hosts per subnet can you get from the network

Here's what you do -

Total number of bits = 23 (we know this from /23)
Network bits = 16 (since this is a class B address)

so, 2^ (23-16) = 2^7 = 128 subnets

and now for the Hosts -

2^ (32 - 23) - 2 = 2^ 9 -2 = 512-2 = 510 hosts per subnet


Let's try another example, where you're given the subnet in decimal:
How many subnets and hosts per subnet can you get from the network

First of all we convert the subnet - corresponds to (you should know the binary to decimal conversion techniques if you're reading this post).
Add them all up 8+8+7+0 and you get 23
So here's what the subnet mask should look like:
which is exactly the same as the one in the first example! Carry on from here, without looking above and see if can get it right. Practice more questions after this and in a few minutes you'll get the hang of it.