roxxhub

What is subnetting ?

Definition

Subnetting refers to the logical division of a network by the means of the network’s IP address

Purpose of subnetting

Lets imagine, there is a company having 10 devices connected through a switch in a network. And now a computer A wants communicate with C.

subnetting

As you might know, A will send a broadcast message to all the devices in the network through the switch. This means every device on the network would receive the broadcast message which was was send by A just to communicate, it might cause a lot of trafficking and even slow down the network

To overcome this problem the organization needs to break down the network into smaller networks. This might be possible by installing new switches, but as you know this would cost a lot. And even if that doesn’t sound very bad, what would happen if the number of devices need to be connected increase ?

This is where subnetting comes into play.

Subnet mask

Lets see how subnetting virtually divides a network.

Basically an ip address has two parts – a network part and a host part

Here 192.168.1 part describes the network id of the devices in the LAN whereas 1, 2, 69 is their host id. Here the first 3 octets or the first 3 bytes of IP are used as the host part. This means the network can have 255 devices in it.

To determine which portion of the IP address is the host portion, we use something called subnet masks.

A subnet mask, which resembles an IP address simply just masks the host part of the IP.

Lets say in an IP 10.10.1.0, we have a mask 255.255.0.0. This means the first 2 octets are being used as the host id. how do we know that? lets see. Here’s a converter

subnetting

First we convert both, the ip address which we want to split into different networks and the subnet mask lined up together. The digit which has a corresponding ‘1’ in the mask is considered the network part. And the rest is the host part. If you will change the first digit of the 3rd octet of the subnet mask from 0 to 1, it will give you 2 networks defined by 2 masks 11111111.11111111.10000000.00000000 and 11111111.11111111.00000000.00000000 i.e 255.255.0.0 and 255.255.128.0. These are often represented in their CIDER notation- 10.10.1.0/17. Here 17 simple tells the number of 1 masking an IP from the start

Now the example we had, lets say the organization needs to split its network into 4 parts, which would represent a certain branch. And we have our reserved ip 192.168.2.0.

We can use the netmask 255.255.255.192 or 11111111.11111111.11111111.11000000.

This way we’ll get our 4 networks and a total of 2^6 = 64. Try figuring out yourself why that happens.