Home > Subnetting Tutorial – Subnetting Made Easy

Subnetting Tutorial – Subnetting Made Easy

September 28th, 2011 Go to comments

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:

Class_C_binary_form.jpg

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.

Comments (198) Comments
Comment pages
1 2 3 4 850
  1. Bargavi
    March 8th, 2014

    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

  2. Ajay Phadtare
    March 18th, 2014

    great Work !!!!

  3. laryy
    March 21st, 2014

    nice one :) informative

  4. larry james cabalida
    March 21st, 2014

    awesome@_@

  5. kim jamora
    March 21st, 2014

    anu po ang ip subnetting?

  6. musthaq
    March 25th, 2014

    Good work. Thanks a lot friends

  7. adf
    April 6th, 2014

    this was one of the rare instructions that were crystal clear and easy to understand

    kudos to you

  8. Dan
    May 8th, 2014

    Excellence. This is easy to understant than many books I have read about subnets. Thanks a lot.

  9. Saad yousaf
    May 8th, 2014

    easily understandable

  10. Ysabel
    May 24th, 2014

    It’s been very informative and well explained thank you

  11. pradip
    May 27th, 2014

    easy to lern thanks alote good job

  12. pradip
    May 27th, 2014

    understandable and queck lernable mater

  13. :D
    May 29th, 2014

    :o

  14. Barno
    June 13th, 2014

    Thank you!

  15. Ali yusuf bakal
    June 24th, 2014

    I don’t understand what is the subnetting mask

  16. Kumar Gaurav Singh
    June 24th, 2014

    Thank you for providing such a good presentation.

  17. kherbek
    July 1st, 2014

    thanks it is helpfull

  18. Laurente XTIAN
    July 15th, 2014

    HELPFUL! GOOD TUTORIAL! WELL EXPLAINED!

  19. Imran
    July 19th, 2014

    Very helpful, presented in a simple and understandable format. Thanks once again!

  20. Bhuwan
    July 24th, 2014

    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???

  21. Ramandeep
    July 28th, 2014

    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! :-/

  22. Ramandeep
    July 28th, 2014

    10.10.20.10/21
    Solve this… write its subnetwork ids…

  23. Emmnaouel
    August 3rd, 2014

    To Ramandeep

    No. Of subnetwork bits= 13 bits
    Valid host/subnet= 11 bits

  24. sumit
    August 11th, 2014

    Awesome!! keep writing tutorials like this.
    Thank you

  25. In this article, we will learn how
    August 19th, 2014

    In this article, we will teach …. perhaps is better english

  26. A.N.M.NISHAD
    September 1st, 2014

    VERY USEFUL NOTES……..

  27. Anonymous
    September 5th, 2014

    It help me so much!! Thank you so MUCH!!

  28. Mohammad Mozamel
    October 8th, 2014

    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

  29. Anthony
    October 9th, 2014

    Thanks a lot for this tutorial. :)

  30. Mariyam
    November 4th, 2014

    Thank you so much for making these tutorials available to everyone !

  31. KAUSHIK
    November 12th, 2014

    Excellent and Lucid way.Simple..

  32. Eugene
    November 15th, 2014

    Thanks I liked everything in your presentation,let GOD reaching BLESS you .

  33. geteneh
    December 9th, 2014

    thanks

  34. mohammed mussa
    December 26th, 2014

    I would like to thank for submit mask presentation

  35. mohammed mussa
    December 26th, 2014

    I wiil amember of your programing design

  36. Mason
    February 21st, 2015

    Please help,

    Why 2001:0db8:0:130h::87c:140b is not a valid IPV6 address?

  37. Mason
    February 21st, 2015

    Please help,

    What does it means when a question said “All of the networks are configured with the ip subnet-zero command” ?

  38. loigie panganoron
    February 21st, 2015

    good job

  39. Tauseef Yaseen
    February 22nd, 2015

    Thaank u…it is very help for me.

  40. ameer kabir
    February 26th, 2015

    subnetting becomes very simple after I finished the article thanks a lot

  41. ameer kabir
    February 26th, 2015

    is there any article for CIDR or summarization

  42. Anonymous
    March 20th, 2015

    Good stuff. Thanks

  43. M Ali
    March 22nd, 2015

    Excellent Tutorial

  44. gary B.
    March 24th, 2015

    now i need “how to” crack a 11110000.11110000. 11110000.11110000/4 or another simple. issue. Thanks for your help!

  45. Rahul
    April 1st, 2015

    Really confusing

  46. ghoneim
    April 2nd, 2015

    Thanks

  47. Adebayo
    May 4th, 2015

    Thanks a lot still trying to capture it cos am not too conversant with it but now am getting it.

  48. shoogn
    May 11th, 2015

    The loopback is 127.0.0.1 not 127.0.0.0

Comment pages
1 2 3 4 850
Add a Comment