Subnetting Tutorial – Subnetting Made Easy
Calculate how many networks and hosts-per-subnet
In our example, you may raise a question: “when we borrow 8 bits, how many sub-networks and how many hosts per sub-network do it create?”
Note: From now, we will call sub-networks “subnets”. This term is very popular so you should be familiar with it.
How many new subnets?
Because we can change any bit in the second octet to create a new subnet, each bit can be “0″ or “1″ so with this subnet mask (255.255.0.0) we can create 28 more subnets. From here we can deduce the formula to calculate the newly created subnets. Suppose n is the number of bits we borrow:
The number of newly created subnets = 2n |
In our example, we borrow 8 bits so we will have 2n = 28 = 256 subnets!
How many hosts per subnet?
The number of hosts per subnet is depended on the Host part, which is indicated by the “0″ part of the subnet mask. So suppose k is the number of bits “0″ in the subnet mask. The formula to calculate the number of hosts is 2k. But notice that with each subnet, there are two addresses we can’t assign for hosts because they are used for network address & broadcast address. Thus we must subtract the result to 2. Therefore the formula should be:
The number of hosts per subnet = 2k – 2 |
In our example, the number of bit “0″ in the subnet mask 255.255.0.0 (in binary form) is 16 so we will have 2k – 2 = 216 – 2 = 65534 hosts-per-subnet!
Some other examples
Well, practice makes perfect so we should have some more exercises to be familiar with them. But remember that this is only the beginning in your journey to become a subnetting guru :)
Exercise 1
Your company has just been assigned the network 4.0.0.0. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.255.255.0?
(Please try to solve by yourself before reading the solution ^^)
Solution
First of all you have to specify which class this network belongs to. According to Table 1, it belongs to class A (simply, class A ranges from 1 to 126) and its default subnet mask is 255.0.0.0. Therefore if we use a subnet mask of 255.255.255.0, it means we borrowed 16 bits (to convert from 0 to 1).
255.0.0.0 = 1111 1111.0000 0000.0000 0000.0000 0000
255.255.255.0 = 1111 1111.1111 1111.1111 1111.0000 0000
Now use our above formulas to find the answers:
The number of newly created subnets = 216 = 65536 (with 16 is the borrowed bits)
The number of hosts per subnet = 28 – 2 = 254 (with 8 is the bit “0″s left in the 255.255.255.0 subnet mask)
Exercise 2
Your company has just been assigned the network 130.0.0.0. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.255.128.0?
(Please try to solve by yourself before reading the solution ^^)
Solution
130.0.0.0 belongs to class B with the default subnet mask of 255.255.0.0. But is the subnet mask of 255.255.128.0 strange? Ok, let’s write all subnet masks in binary:
255.255.128.0 = 1111 1111.1111 1111.1000 0000.0000 0000
This is a valid subnet because all bit “1″s and “0″s are successive. Comparing to the default subnet mask, we borrowed only 1 bit:
255.255.0.0 = 1111 1111.1111 1111.0000 0000.0000 0000
Therefore:
The number of newly created subnets = 21 = 2 (with 1 is the borrowed bits)
The number of hosts per subnet = 215 – 2 = 32766 (with 15 is the bit “0″s left in the 255.255.128.0 subnet mask)
Exercise 3
Your company has just been assigned the network 198.23.16.0/28. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.255.255.252?
(Please try to solve by yourself before reading the solution ^^)
Solution
In this exercise, your company was given a “subnetted” network from the beginning and it is not using the default subnet mask. So we will compare two subnet masks above:
/28 = 1111 1111.1111 1111.1111 1111.1111 0000 (=255.255.255.240)
255.255.255.252 = 1111 1111.1111 1111.1111 1111.1111 1100 (= /30)
In this case we borrowed 2 bits. Therefore:
The number of newly created subnets = 22 = 4 (with 2 is the borrowed bits)
The number of hosts per subnet = 22 – 2 = 2 (with 2 is the bit “0″s left in the 255.255.255.252 subnet mask)
In this exercise I want to go a bit deeper into the subnets created. We learned there are 4 created subnets but what are they? To find out, we should write all things in binary:
Because two subnet masks (/28 & /30) only affect the 4th octet so we don’t care about the first three octets. In the 4th octet we are allowed to change 2 bits (in the green box) of the IP address to create a new subnet. So there are 4 values we can use: 00, 01, 10 & 11. After changing, we convert them back to decimal numbers. We get 4 subnets:
+ First subnet: 198.23.16.0/30 (the 4th octet is 00000000)
+ Second subnet: 198.23.16.4/30 (the 4th octet is 00000100)
+ Third subnet: 198.23.16.8/30 (the 4th octet is 00001000)
+ Fourth subnet: 198.23.16.12/30 (the 4th octet is 00001100)
So how about hosts per subnet? Please notice that all these 4 subnets are successive. So we can deduce the range of these subnets:
+ First subnet: ranges from 198.23.16.0 to 198.23.16.3
+ Second subnet: ranges from 198.23.16.4 to 198.23.16.7
+ Third subnet: ranges from 198.23.16.8 to 198.23.16.11
+ Fourth subnet: ranges from 198.23.16.12 to 198.23.16.15
Let’s analyze the first subnet which ranges from 198.23.16.0 to 198.23.16.3. Notice that all networks (and subnets) have a network address and a broadcast address. In this case, the network address is 198.23.16.0 and the broadcast address is 198.23.16.3 and they are not assignable or usable for hosts. This is the reason why we have to subtract 2 in the formula “The number of hosts per subnet = 2k – 2″. After eliminating these 2 addresses we have 2 addresses left (which are 198.23.16.1 & 198.23.16.2) as calculated above.
In the next part we will learn how to calculate subnet quickly. This is also a “must” requirement for CCNA so you have to grasp it.
Nice Presentation
I really forgot all this subnetting but I thank for the author so much
I have recovered them all
Subnetting was so hard
Now it is easy just as the title of this presentation
great Work !!!!
nice one :) informative
awesome@_@
anu po ang ip subnetting?
Good work. Thanks a lot friends
this was one of the rare instructions that were crystal clear and easy to understand
kudos to you
Excellence. This is easy to understant than many books I have read about subnets. Thanks a lot.
easily understandable
It’s been very informative and well explained thank you
easy to lern thanks alote good job
understandable and queck lernable mater
:o
Thank you!
I don’t understand what is the subnetting mask
Thank you for providing such a good presentation.
thanks it is helpfull
HELPFUL! GOOD TUTORIAL! WELL EXPLAINED!
Very helpful, presented in a simple and understandable format. Thanks once again!
I always think subnetting for me is not that much hard but when it comes for Class A and B, I just confused a lot,.., Class A and B are similar to Class C but practicall., I always confused with it. Any one has quick and fast way to subnet Class A and B???
10.100.100.172/24
No. Of subnetwork bits= 16
Valid host/subnet= 254
As it is classles
Now there is a question having
10.10.20.10/21
No. Of subn/w bits=5 or 13
As for taking 5 its block size would be 8 and and hence total no. Of subn/w are satisfied(32)
But taking 13 block size could make out 9176 subn/w
(Its classless too)
Tell me sir what would be the answer as it is literally becoming a nightmare! :-/
10.10.20.10/21
Solve this… write its subnetwork ids…
To Ramandeep
No. Of subnetwork bits= 13 bits
Valid host/subnet= 11 bits
Awesome!! keep writing tutorials like this.
Thank you
In this article, we will teach …. perhaps is better english
VERY USEFUL NOTES……..
It help me so much!! Thank you so MUCH!!
Nice Presentation
Subnetting is the Root of Networking if We Don’t Practice Subnetting Examples it will forgot Faster then other Protocols
Try to Design Your Lab Simulations in VLSM forms otherwise You Will Forgot Sebnetting
Thanks a lot for this tutorial. :)
Thank you so much for making these tutorials available to everyone !
Excellent and Lucid way.Simple..
Thanks I liked everything in your presentation,let GOD reaching BLESS you .
thanks
I would like to thank for submit mask presentation
I wiil amember of your programing design
Please help,
Why 2001:0db8:0:130h::87c:140b is not a valid IPV6 address?
Please help,
What does it means when a question said “All of the networks are configured with the ip subnet-zero command” ?
good job
Thaank u…it is very help for me.
subnetting becomes very simple after I finished the article thanks a lot
is there any article for CIDR or summarization
Good stuff. Thanks
Excellent Tutorial
now i need “how to” crack a 11110000.11110000. 11110000.11110000/4 or another simple. issue. Thanks for your help!
Really confusing
Thanks
Thanks a lot still trying to capture it cos am not too conversant with it but now am getting it.
The loopback is 127.0.0.1 not 127.0.0.0