How to do Subnetting
Logical division of IP addresses inside network is subnetting or we can say, The process of giving host bits to network is subnetting. We already know that only a limited number of ipv4 addresses are available. We need to use these ipv4 addresses wisely and there are three ways for it.
- Private IPs
- IPv6
- SubnettingSo now we are going to learn What happens if we don’t do subnetting using example.
Prerequisites for subnetting in networking
- What is IP Address
- Convert IP Address from Decimal to Binary
- The “What is Subnetting” Article of Your Dreams
In case you are interested in CIDR you can check here.
What happens if we don’t do subnetting
So now we are going to learn What happens if we don’t do subnetting using example.

We want to assign two IPs 190.20.10.15 and 190.20.10.2 in two different sub-networks. We know that every interface of router must have a different network, which means every interface of router should have a different network ID. Now we can see in the above picture that we have given two different IPs to two different machines in two different networks. But there is a problem here. Both the IPs have same Network IDs.

It is not possible having the same network IDs in two different networks.
If we use the same network IDs for different router interfaces, router would not know in which network the traffic has to be send.
We can think of Network ID as a pin code and router as post office. If two cities have the same pin code, Post office would not know for which city the letter is to be dispatched.
We can give anything apart from 190.20.0.0 which can be like 15.10.0.1. Here we can see that Network IDs 190.20.0.0 and 15.10.0.0 belongs to two different networks, as a result these can be used in a big network.

Moreover by now if you are thinking that while creating subnets we cannot use the network IDs of the same class, you are wrong. We can use the same class network IDs in creating subnets until unless the network IDs are different.
We can create subnets using networks 200.10.10.0
and 200.10.11.0
, which are Class C networks because both of these have different network IDs.
Subnet Mask
Before going further we need to understand what is Subnet Mask.
Network mask is a number which defines the range of IP Address which is being used in a network.
We call it a mask because it masks the network part of an IP Address and leaves the host part as it is.
IP Address Class | Default Subnet Mask |
---|---|
A | 8 |
B | 16 |
C | 24 |
If there is only default Subnet Mask is given in CIDR, then there is no subnetting done.
From the above table we can conclude that if Subnet Mask of any IP address of class A is 8, then no subnetting has been done.
So if our CIDR is 10.0.0.0/8 then and there is no subnetting.
Subnetting of an IP Address using examples
Create subnet from CIDR 197.10.10.0/24 based on below diagram.

We can see that this is a class C IP address Subnet Mask is 24 which is default Subnet Mask for this class.
Get Network and Host parts

Convert Host part to binary
- 10.10.00000000
Calculate How many IPs can be given to biggest subnet (which have 40 machines) using below formula
2n -2 >=40
26 -2 >=40
62-2 >=40
n=6
According to this formula we can give 62 IPs in this subnet, though it is up us how many we want to assign.
Divide bits into Network and Host
Reserve n (6) bits to host and give remaining bits to network (Remember the Subnet definition in the beginning of the article?) which is 2

We know that the Subnet mask given is 24 which represent network. Now we will give these two bits to network and we will get our first subnet which is
197.10.10.0/(24+2)
197.10.10.0/26
Important thing to remember here is we represent host bits by 0 and Network bits by 1.
Formula: Catch the running ones

Divide the subnets further
- The second network would be
197.10.10.64/26
- Now add 64 again to last octet and we get:
197.10.10.128/26
- Fourth network would be:
197.10.10.(128+64)/26
10.10.192/26
- Next network would be
197.10.10.256/26
which is wrong as max no. in an octet can be 255
So with this CIDR we can create only 4 subnets in this particular network.
To create 5 subnets you would need to go for Class B CIDR