post image for subnetting

What is Subnetting (and How to Subnet IPv4 Network)?

In this article, we’ll explain the basics about IP addresses, subnet masks and subnets. If you use Windows OS and you enter ipconfig in Command Prompt, chances are that somewhere in the output you’ll see something like:

IPv4 Address. . . . . . . . . . . : 192.168.0.11
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

From the given output, we can conclude few things:

  • The IP address of the computer (host) is 192.168.0.11
  • The network address is 192.168.0.0
  • The network can have 254 hosts
  • The last host in the given network will have the IP address 192.168.0.254

So, how exactly do we know about the above, and what do they mean in the first place?

What is an IPv4 address?

Every device in a network must be uniquely identified in order to be able to communicate with other devices in other networks and the Internet. The unique identifier for the device in the network is its IP address.
From the output above, we can see that the IP address is 192.168.0.11, so an IP address is a group of four decimal numbers separated by dots. Every number is between 0 and 255. The IP address is divided into two parts:

  • The network part of the IP address
  • Host part of the IP address

In our example network part is 192.168.0 and the host part is .11 In the given example host part can be between 1 and 254. The next logical question is how we decide what is the network part and what is host part? For that purpose subnet mask is used.

What is a subnet mask?

Subnet mask hides (or masks) the network part IP address and shows only the host part as the device identifier. In our example, subnet mask 255.255.255.0 means that the first 3 numbers of the IP address are the network part and the last number is the host (device) part/identifier. For example, if the subnet mask is 255.255.0.0, that means the first 2 numbers of the IP address are the network part and the last 2 numbers are the host part.

What is Subnetting?

Subnetting is the procedure of dividing a network into two or more smaller (sub)networks called subnets. To fully understand subnetting, we must know that computers and network devices use the binary number system for communication. With that being said, our IP address and subnet mask would be as follows:

IP address: 192.168.0.11 (Dec) = 11000000 10101000 00000000 00001011 (Bin)
Subnet mask: 255.255.255.0 (Dec) = 11111111 11111111 11111111 00000000 (Bin)

When we write an IP address in binary form, we can see that an IPv4 address has 32 bits. Another way of saying that the subnet mask is 255.255.255.0 is just to write it as /24. This means that the first 24 bits are the network address and the last 8 bits are the host address. We already told you that the network address is 192.168.0.0, but how do we calculate that? To get the network address, we do a logical AND operation between the host address and its subnet mask, so:
11000000 10101000 00000000 00001011 & 11111111 11111111 11111111 00000000 = 11000000 10101000 00000000 00000000
In decimal, the network address is 192.168.0.0/24

Network 192.168.0.0/24 uses the last 8 bits for the host address. With 8 bits, we have 256 numbers from 0 to 255 (because 28=256). First address 192.168.0.0 is a network address, last address 192.168.0.255 is called a broadcast address. Those are two addresses we can’t use as addresses for hosts; the reasons for that will be explained in a future article.

Let’s say we have a company where we want to have 2 networks (subnets), first for PCs in the wired network (LAN) and second for WiFi (WLAN). We will use network 192.168.0.0/24 and divide it into two smaller /25 networks:

Example of /25 subnet
As you can see from the image above, we “borrowed” 1 bit from the host part of the address to use it in the network part, so we have a first /25 network, which is 192.168.0.0/25, and a second /25 network, which is 192.168.0.128/25.

First subnet parameters are as follows:
Network address: 192.168.0.0/25
Usable (host) addresses: 192.168.0.1 to 192.168.0.126
Broadcast address: 192.168.0.127
Subnet mask: 255.255.255.128

Second subnet parameters are as follows:
Network address: 192.168.0.128/25
Usable (host) addresses: 192.168.0.129 to 192.168.0.254
Broadcast address: 192.168.0.255
Subnet mask: 255.255.255.128

At the end /26 example is given, so try to figure out the rest of the parameters yourself 🙂

Example of /26 subnets

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *