Subnetting

Kulani Baloyi / Jul 13, 2024

5 min read

Carving Up the Network : A Guide to Subnetting


First lets recap something do you remember how IPv4 addresses are represented?

They are 32 numbers divided into 4 octets each separated by a dot

What is subnetting?

Subnetting is when we divide a larger network into smaller subnetworks by borrowing bits from the host part of the IP address to create the subnet address.

For example :

255.255.255.0

The subnet mask right here means that the first 24 bits are for the network and the remaining 8 bits are for the host.

Okay cool but why 24 you ask?

Well lets convert that to binary:

BinaryDecimalDescription
11111111255Network portion (fixed to 1 for /24 subnet mask)
11111111255Network portion (fixed to 1 for /24 subnet mask)
11111111255Network portion (fixed to 1 for /24 subnet mask)
000000000Host portion (fixed to 0 for /24 subnet mask)

Notice that we have 24 ones and 8 zeros. The ones indicate the network portion and the zeros that follow indicate the host portion

Another simpler way to represent the subnet mask is as /24 (CIDR notation)

Heres an example, take:

192.168.12.37/28

This means I have 28 bits for the network part and the 4 remaining are for the host part.

To represent the same I.P address and subnet mask in binary form it would work out to be:

IP -> 11000000.10101000.00001100.00100101

Subnet Mask-> 11111111.11111111.11111111.11110000

We can find the network address by performing a bitwise "AND" operation. For this example it would work out to be:

Network Address:
11000000.10101000.00001100.00100000

192.168.12.32

Then if we invert the subnet mask and perform a bitwise "OR" operation, we find the broadcast address:

Broadcast Address:
11000000.10101000.00001100.00101111

192.168.12.47

All addresses in between are our usable IP addresses:

Network Address:
192.168.12.32

Usable Range:
192.168.12.33-192.168.12.46(14 hosts)

Broadcast Address:
192.168.12.47

So why even divide our network?

There are many reasons but some benefits include;

In summary, subnetting offers a way to create more manageable, secure, and efficient networks. It's a fundamental concept in network administration that helps ensure smooth operation and optimal resource allocation.

Related articles:

What is the internet?
Apr 21, 2024