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 (12) Comments
Comment pages
1 4 5 6 850
  1. khaloood
    December 3rd, 2016

    thank you very much

  2. Anonymous
    December 18th, 2016

    thnx for all

  3. Anonymous
    December 20th, 2016

    There are 500 hosts in a local-network which has no external connection. Due to some administrative requirements the network should be configured to run in five different groups. Such that in each group there will be 100 hosts. However, host should be able to communicate with all the other hosts in its group, but should not be able to communicate with the hosts in other groups. That is to say, each host should perceive the network as if only its group members (199 member hosts) are sharing the network. The network infrastructure is star-type (with switches), fixed (can not be altered). Logical design of the network is shown in the figure below.

  4. Anonymous
    December 20th, 2016

    There are 500 hosts in a local-network which has no external connection. Due to some administrative requirements the network should be configured to run in five different groups. Such that in each group there will be 100 hosts. However, host should be able to communicate with all the other hosts in its group, but should not be able to communicate with the hosts in other groups. That is to say, each host should perceive the network as if only its group members (99 member hosts) are sharing the network. The network infrastructure is star-type (with switches), fixed (can not be altered). Logical design of the network is shown in the figure below.

  5. Anonymous
    December 20th, 2016

    2. There are 500 hosts in a local-network which has no external connection. Due to some administrative requirements the network should be configured to run in five different groups. Such that in each group there will be 100 hosts. However, host should be able to communicate with all the other hosts in its group, but should not be able to communicate with the hosts in other groups. That is to say, each host should perceive the network as if only its group members (99 member hosts) are sharing the network. The network infrastructure is star-type (with switches), fixed (can not be altered). Logical design of the network is shown in the figure below.

    Propose a network-layer solution for the problem stated above andclearly explain the solution.

  6. TRAP
    December 23rd, 2016

    OK

  7. oahu4me
    January 3rd, 2017

    I’d like to get the latest dumps to use as a guide for study. If anyone has recently taken exam, please let me know what sims they are using also. Please send me the latest dumps. Thank You {email not allowed}

  8. oahu4me
    January 3rd, 2017

    Please send latest CCNA dumps for study guide and what sims are recent. oahu4me at yahoo.com

  9. Siya
    January 11th, 2017

    Hi guys, if possible can you please send me CCNA 200-125 dumps, email: siya.nxuseka at gmail.com

  10. Master
    January 14th, 2017

    Please send me the latest dumps off CCNA. email sofi.moomin20 at gmail.com

  11. qweqweq
    January 24th, 2017

    nice

  12. JM
    February 15th, 2017

    Instead of asking for CCNA dumps, try studying the literature.

Comment pages
1 4 5 6 850