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.
Department | Hosts |
---|---|
IT | 275 |
Accounting | 127 |
Sales | 265 |
Marketing | 400 |
Customer Care | 38 |
In this subnetting tutorial we have used VLSM algorithm to calculate 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')
NW = IPAND SM
BC = IPOR ~SM
For next subnet:
IP = BC + 1
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.
Department | Hosts |
---|---|
Marketing | 400 |
IT | 275 |
Sales | 265 |
Accounting | 127 |
Customer Care | 38 |
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.
For subnet with 400,Hence, HB = 9
2^8 = 256 and 2^9 = 512.
here 256 < 400 < 512.
So HB is 9 for subnet Marketing.
We know that subnet mask is 32 bit binary number. as mentioned above NB and HB makes up this 32 bits.Hence, NB = 23
SM = 32
NB + HB = 32
NB = 32 - HB = 23
Once we have NB and HB it's very easy to get subnet mask.
Hence for Marketing (400 hosts subnet) subnet mask is 255.255.254.0Write 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 = 255.255.254.0
Repeat the step #2 for each departments.
After Step #2 we will have following details.
Department | Hosts | subnet mask |
---|---|---|
Marketing | 400 | 255.255.254.0 |
IT | 275 | 255.255.254.0 |
Sales | 265 | 255.255.254.0 |
Accounting | 127 | 255.255.255.0 |
Customer Care | 38 | 255.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.
We will be using Class C range. Starting IP Address 192.168.0.0Available private IP range
Class A 10.0.0.0 - 10.255.255.255
Class B 172.16.0.0 - 172.31.255.255
Class C 192.168.0.0 - 192.168.255.255
To find Network Address, do Bitwise AND operation between IP address and subnet mask.
IP address | 11000000101010000000000000000000 | 192.168.0.0 |
---|---|---|
subnet mask | 11111111111111111111111000000000 | 255.255.254.0 |
BITWISE AND | ||
Network Address | 11000000101010000000000000000000 | 192.168.0.0 |
To find we need to do Bitwise OR between IP Address and wildcardmask. Wildcardmask is inverted subnet mask.
IP address | 11000000101010000000000000000000 | 192.168.0.0 |
---|---|---|
Wildcardmask | 00000000000000000000000111111111 | 0.0.1.255 |
BITWISE OR | ||
Broadcast Address | 11000000101010000000000111111111 | 192.168.1.255 |
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.
Department | Hosts | subnet mask | Network Address | Broadcast Address |
---|---|---|---|---|
Marketing | 400 | 255.255.254.0 | 192.168.0.0 | 192.168.1.255 |
IT | 275 | 255.255.254.0 | 192.168.2.0 | 192.168.3.255 |
Sales | 265 | 255.255.254.0 | 192.168.4.0 | 192.168.5.255 |
Accounting | 127 | 255.255.255.0 | 192.168.6.0 | 192.168.6.255 |
Customer Care | 38 | 255.255.255.192 | 192.168.7.0 | 192.168.7.63 |
Step #4 : Allocate IP address for subnet.
We can allocate any IP between Network Address and Broadcast Address to hosts in the subnet.
Department | Hosts | subnet mask | Network Address | Broadcast Address | IP Range |
---|---|---|---|---|---|
Marketing | 400 | 255.255.254.0 | 192.168.0.0 | 192.168.1.255 | 192.168.0.1 - 192.168.1.254 |
IT | 275 | 255.255.254.0 | 192.168.2.0 | 192.168.3.255 | 192.168.2.1 - 192.168.3.254 |
Sales | 265 | 255.255.254.0 | 192.168.4.0 | 192.168.5.255 | 192.168.4.1 - 192.168.5.254 |
Accounting | 127 | 255.255.255.0 | 192.168.6.0 | 192.168.6.255 | 192.168.6.1 - 192.168.6.254 |
Customer Care | 38 | 255.255.255.192 | 192.168.7.0 | 192.168.7.63 | 192.168.7.1 - 192.168.7.62 |
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.