In this subnetting tutorial we will learn about Subnet Calculation.

After this subnetting tutorial you will have clear idea on How to allocate IPs for each subnet or How to do subnetting or How to design internal network of orgnization?

If you are designing network from scratch, first you will need to find out how will you divide the network. Generally you can divide the network in logical subnet, consider that you are designing network for organization, you can divide network based on departments, i.e.Sales, IT, Marketing, Customer care, Human resources, Accounting, etc. or let's say for college or school we can divide network based on branch or lab wise. for example in engineering college, you can divide branch wise, i.e. Computer Engineering, Information Technology, Electronics & Communication and so on.

Also prepare table with total number of hosts required in each subnet. Any machine connected with network needs at least one unique IP address to communicate within network. you also need to consider that many devices can have multiple ways to connect to network, Laptop can be connected using LAN or through your Wireless network, which means you need to allocate IP per connection.

Once you gather required information, you can start with subnetting or allocation IP address range to subnet.
We will consider a scenario where we need to design network for organization. Required information is mentioned below.

Customer Care38

In this subnetting tutorial we have used VLSM algorithm to calculate subnet.

VLSM algorithm

Step #1 Sort subnet in decreasing order based on number of hosts required.

Step #2 Find subnet mask for each subnet.

Max Hosts < 2 ^ HB
NB = 32 - HB
SM = NB (times 1) + HB (times 0)
i.e for NB = 23 and HB = 9, SM = 11111111111111111111111000000000 (23 times '1' + 9 times '0')

Step #3 Find Network Address and Broadcast Address.

For next subnet:
IP = BC + 1

Step #4 Allocate IP for each subnet.

RANGE = NW + 1 to BC - 1
REPEAT #3 for all subnet.

Detailed Explanation:

Step #1 : Sort subnet based on number of hosts.

Sort subnet in descending order based on number of hosts. We will allocate IP ranges for larger subnet first, then second largest subnet and so on. So that network overlapping can be avoided.

Customer Care38

Step #2 : Find subnet mask for each subnet.

To find subnet mask we will first find network bits (NB) and host bits (HB) required for each subnet.
Subnet mask can be represented as NB and HB. Once we have NB and HB, We will be able to find subnet mask.

Let's find NB and HB :

For hosts bits we have to find closest power of 2, that is larger than required number of hosts.

Host Bits (HB):
For subnet with 400,
2^8 = 256 and 2^9 = 512.
here 256 < 400 < 512.
So HB is 9 for subnet Marketing.
Hence, HB = 9
Network Bits (NB):
We know that subnet mask is 32 bit binary number. as mentioned above NB and HB makes up this 32 bits.
SM = 32
NB + HB = 32
NB = 32 - HB = 23
Hence, NB = 23

Once we have NB and HB it's very easy to get subnet mask.

subnet mask (SM):
Write consecutive '1' NB times. here NB is 23
NB = 11111111111111111111111

Now append consecutive '0' HB times with NB. here HB = 9.
SM = 11111111111111111111111000000000

Divide in 4 octets
SM = 11111111.11111111.11111110.00000000

Convert octets to decimal
SM =
Hence for Marketing (400 hosts subnet) subnet mask is

Repeat the step #2 for each departments.

After Step #2 we will have following details.

DepartmentHostssubnet mask
Customer Care38255.255.255.192

Step #3 : Find Network Address and Broadcast Address for each subnet.

We will need Starting IP address and subnet mask for each subnet. We have already found subnet mask for each subnet.

IP Address :

If you are designing internal network for organization, you have to use any available private IP range.

Available private IP range
Class A -
Class B -
Class C -
We will be using Class C range. Starting IP Address
Network Address:
To find Network Address, do Bitwise AND operation between IP address and subnet mask.
IP address11000000101010000000000000000000192.168.0.0
subnet mask11111111111111111111111000000000255.255.254.0
Network Address11000000101010000000000000000000192.168.0.0
Hence, Network Address for Marketing subnet is
Broadcast Address:
To find we need to do Bitwise OR between IP Address and wildcardmask. Wildcardmask is inverted subnet mask.
IP address11000000101010000000000000000000192.168.0.0
Broadcast Address11000000101010000000000111111111192.168.1.255
Hence, Broadcast Address for Marketing subnet is

Repeat the step #3 for each departments.
While doing further calculation, Starting IP address for Next (IT) subnet is next IP to Broadcast Address of Previous (Marketing) subnet.

After Step #3, We will have following details.

DepartmentHostssubnet maskNetwork AddressBroadcast Address
Customer Care38255.255.255.192192.168.7.0192.168.7.63

Step #4 : Allocate IP address for subnet.

IP Allocation:
We can allocate any IP between Network Address and Broadcast Address to hosts in the subnet.
DepartmentHostssubnet maskNetwork AddressBroadcast AddressIP Range
Marketing400255.255.254.0192.168.0.0192.168.1.255192.168.0.1 -
IT275255.255.254.0192.168.2.0192.168.3.255192.168.2.1 -
Sales265255.255.254.0192.168.4.0192.168.5.255192.168.4.1 -
Accounting127255.255.255.0192.168.6.0192.168.6.255192.168.6.1 -
Customer Care38255.255.255.192192.168.7.0192.168.7.63192.168.7.1 -
Using this information you can configure interVLAN.

Hope you like this subnetting tutorial.
Subnetting is foundation, you have to build it as strong as you can!!. You will be able to do subnetting on the fly, Practice is the key. You can verify your answers using Subnet Calculator while practicing.
If you have any questions in subnetting tutorial, feel free to Contact Us at any time.

© 2015 - 2024