Subnet and Subnetting
Hello guys, I’m back with my new blog. Today we’re going to talk about something important in the world of networking. I know there is no point in building suspense — you already read the title, and that’s why you’re here. But I’ll still do it, because this is for my regular readers who are following my series and are beginners 😎.
That’s enough chit-chat. Now let’s start.
I don’t want to make it boring by just giving definitions and facts. I’ll make this interesting — trust me. Stay with me till the end of this blog.
Imagine… :P
Imagine you open a company/startup. Initially, you have only 20 employees with their computers, and they all use them for different tasks inside the same local network — more specifically, on the same router. As of now, they are very few in number; hence, a single router can handle the traffic.
But over time your company grows and you hire more and more employees. Let’s suppose you have 1000 now, and they are all doing different tasks on their computers. Now a single router may suffer through a large number of problems while handling all the traffic at once.
For example, frequent unnecessary packet inspection happens because all computers receive data from the internet through the same router. So they have to respond to broadcast messages for checking IP addresses. It wasn’t a big deal when devices were few, but as the number increases it will become too frequent and can hamper performance.
It can also become a big threat to security, as any employee can discover and inspect data packets meant for any other device. It may become too dangerous — because what if other departments like finance and security are on the same network? Their information is far too sensitive for an organization.
And not only that — suppose troubleshooting a problem on a network with over a thousand devices is not easy.
Then what’s the solution?
The solution is simpler than you think — just kidding. By this time you may have already guessed it.
Yeah, just divide them into smaller networks, dude — like the old saying: “If you think a problem is too big, then divide it into smaller parts.”
In networking terminology, we call this solution subnetting, and the smaller networks subnets.
Now let’s define it in a formal way.
What is a subnet and subnetting?
A subnet (short for subnetwork) is a network inside a network that makes networking more efficient. It also helps in optimizing network traffic within a network by shortening the distance traveled by a data packet. The process of making subnets is called subnetting.
Understand it like this: while planning a city, you group a bunch of houses and make a society with a unique name for identification, which later helps to find a house through a detailed address easily.
As I said, dividing the network into smaller parts doesn’t mean we need to make every single part a local network itself. Instead, we use a technique called subnet masking. It makes subnetting much more efficient.
It comes with many different advantages: you can broadcast in a subnet and it will be limited to that single subnet even if other subnet devices are on the same router. It’s a great move if security is a concern, and it also helps in troubleshooting network problems.
Subnet Mask
Do you remember in my IP address blog I told you guys something — that it has 2 parts: first is the Network ID and another is the Host ID? At that time, did you think about how it was decided what part describes what? Whether you thought it or not, I’ll tell you anyway.
It’s the subnet mask that decides how much of the initial part of an IP address represents the Network ID (obviously, the remaining part represents the Host ID). It is a 32-bit number written pretty much the same way as IPv4 (i.e., 4 octets of 8 bits), in which the 1s represent the network part and the 0s the host part.
Let’s understand this with a simple example.
Suppose the IP address is “192.168.1.10”.
Hence, the binary representation of this is “11000000.10101000.00000001.00001010”.
Now assume its subnet mask is “11111111.11111111.11111111.00000000”.
It contains only 1s in the start because the system counts the number of 1s and considers the same number of bits as the Network ID, and the rest as the Host ID. The interesting thing is that if you want to divide the network into even smaller networks, then you just have to increase the number of bits that determine the Network ID.
CIDR notation
To represent a subnet mask with the IP address, we use the “IP address/number of bits” notation. This is called CIDR (Classless Inter-Domain Routing) notation.
Example: 1). 192.168.1.9/24 (initial 24 bits represent the Network ID)
2). 192.168.1.9/26
(Below is just a fun initiative by me. Ignore it if you don’t like it.)
Subnetting in Action
After knowing what a subnet mask represents and its significance, now I will show you how it’s actually divided; that is, we will form a subnet from the previous subnet by borrowing a bit.
First, let’s take an example. Suppose we have an IP address “192.168.1.0/24”. As you already know, here the first 24 bits represent the network ID. Hence, we will be left with 8 bits (32–24). Now you can see we can have a total of 256 addresses (as 2⁸ = 256), in which one is the network address and the other is the broadcast address. So we are left with 254 addresses to allocate, which means we can have 254 devices in this network.
(If you don’t understand how I wrote 256, then I recommend that you gain some basic knowledge about binary numbers and their conversion into other bases — most importantly, base 10.)
Now, suppose you want to further divide the subnet into 2 parts — meaning into even smaller subnets — then you can borrow one bit from the Host ID and include it in the Network ID. As you know, a bit can only have 2 possible values: 0 or 1.
Hence, the subnet with 0 as the 25th bit will have 192.168.1.0 as the network address and 192.168.1.127 as the broadcast address. The remaining addresses between them, “192.168.1.1–192.168.1.126”, are usable for devices. Similarly, with 1 as the 25th bit, it will range from 128–255 as the range of the last octet.
(I divided both at 128 because 2⁷ is 128.)
Get Shubh Varshney’s stories in your inbox
Join Medium for free to get updates from this writer.
You can now divide the subnets even further if you want.
Note: If you’re reading this for academic exams, keep in mind that I haven’t covered how to calculate the number of hosts, how to find the range of IP addresses, or, most importantly, the binary calculations behind subnetting. I intentionally skipped those topics because my goal isn’t to prepare you for exams — it’s to help you understand the core concepts.
Once you have a basic understanding of binary, subnet calculations become much easier. One useful thing to remember is that the place value of the selected bit in the last octet determines the subnet increment (or range).
If you’re still confused about subnet calculations or can’t find good resources, let me know in the comments. If enough people are interested, I’ll write a dedicated article covering binary and subnet calculations in detail.
Real-World Examples
Although subnetting is one of the most important concepts in networking, let’s look at some common real-world applications.
1. Home Networks
Subnetting isn’t very useful in most homes because a typical home network uses only a single subnet.
2. Colleges
Colleges use subnetting to separate the student Wi-Fi network from administrative and departmental networks. They may also create separate subnets for different departments such as Computer Science, Mechanical Engineering, or Administration.
3. Offices
Companies use subnetting to separate different departments, such as Finance, HR, Sales, and Guest Wi-Fi. This improves security, reduces unnecessary network traffic, and makes the network easier to manage.
4. Cloud Networks
Cloud platforms such as AWS, Azure, and Google Cloud use subnetting extensively to separate different cloud resources, such as web servers, application servers, databases, and private internal services.
(The section below is just a fun initiative by me. Feel free to skip it if it’s not your thing.)
Quote of the blog (Off topic :)
“If you think life is hard, then you are correct ;)”
That’s it for today, guys. I will be back with a new topic soon.
Also, I have some good news — I’ve created a Discord server for all of us beginners, where we can learn together, help each other, and discuss networking and cybersecurity. The invite link is below.
You’re also welcome to reach out and chat with me there.
Till then, “DO WHATEVER YOU WANT!!”
(Source: GeekforGeeks, Cisco, Cloudflare, and my brain)







