Understanding Subnetting

Defining network IDs, hosts and broadcast — the easy way!

Aquiles Gomez
Tech Jobs Academy
4 min readJan 21, 2016

--

In the IT world, there is a reverence towards those who can quickly and accurately subnet a workplace only given the required amounts of hosts or networks. And I don’t just mean they’re good at working them out on paper — I mean in their heads, like some sort of supercomputer that only thinks in 0’s and 1’s…. wait a second…

BUT this “witchcraft” only takes a rudimentary understanding of subnetting and how certain network requirements (network ID & Broadcast) work the way they do. Too many times I come across a person who is trying to solve subnet using hard, on-paper math. Kudos, it’s a great practice, but doesn’t make for much of a party trick (an office party… with the IT department… while working for an ISP) or a time saver. It helps me to visualize and compartmentalize IP address with subnet masks and only focus on the least amount of bits I would have to deal with in order to answer the two most basic questions of subnetting.

While this guide will not go through every detail of how to subnet, it will teach the subnet student, or professional, exactly how to define a given IP address as a network ID, hosts or broadcast. This will effectively allow them to allocate space within a given initial network. And without further ado, let’s begin with the most fundamental part of a new network:

Network ID

“How do you define a Network ID?” is the first question you’ll be asked and want to answer when it comes to setting up a new network. For example, let’s look at this network IP address:

192.168.0.0/23

To understand exactly what defines a network ID, we have to switch our brains to binary:

Network ID: 192.168.0.0/23 -> 11000000.10101000.00000000.00000000

Subnet Mask: 255.255.254.0 ->11111111.11111111.11111110.00000000

BONUS: The /23 only defines the amount of ones in the subnet mask. The rest are all zeroes:

[32 bits in an IP address — 23 ones in subnet= Nine zeroes (or bits) left for hosts]

When it comes to what defines a network ID from a host, let’s forget for a moment that every 1 bit in the subnet mask is (ironically) irrelevant. Instead, let’s look at the zeroes of that subnet mask instead:

IP address: 192.168.0.0/23 -> 11000000.10101000.0000000|0.00000000

Subnet Mask: 255.255.254.0 ->11111111.11111111.1111111|0.00000000

Note that both subnet mask host bits and matched IP address bits are all zeroes. This is how you define a network ID.

Host IP

“What about 192.168.1.0/23??? That looks like a legit network ID to me!”

That is, in fact, a host! By defining it with the matching zeroes rule, it becomes apparent why this is the case:

IP address: 192.168.1.0/23 -> 11000000.10101000.0000000|1.00000000

Subnet Mask: 255.255.254.0 ->11111111.11111111.1111111|0.00000000

Therefore, 192.168.1.0/23 is in fact a host on the 192.168.0.0/23 network.

This IP address could be a viable network ID if the subnet mask is simply shifted one more unit to the right, making it a /24 subnet mask. Let’s see how that looks:

IP address: 192.168.1.0/24 -> 11000000.10101000.00000001|.00000000

Subnet Mask: 255.255.255.0->11111111.11111111.11111111|.00000000

Because now the zeroes all lined up to the right, the IP address is now a viable network ID with the subnet mask /24.

Broadcast

“What about the case where it matches up with all ONES instead of all ZEROES?”

Now when you take all that we have applied towards network IDs with the zeroes matching up and, instead, match up ones with those zeroes, you now have a broadcast IP address. Using our same example with the network ID, let’s see how that looks:

IP address: 192.168.1.255/23 ->11000000.10101000.0000000|1.11111111

Subnet Mask: 255.255.254.0 -> 11111111.11111111.1111111|0.00000000

To be a viable broadcast, this IP address has to tell the computer to “send this packet to all possible combinations of ones and zeroes, not just one unique combination of ones and zeroes.” This is exactly what is accomplished when all subnet mask zeroes reserved for hosts are matched with all ones of the IP address.

What should you have learned today?

When looking at our IPs and subnets in binary, it could be said that when the allotted zeroes on the subnet mask match with identical zeroes on an IP address, it is a viable network ID within that subnet mask’s scope. Conversely, all ones within that scope makes it a broadcast IP address within a network. A combination of both ones and zeroes make it a host within a network. With this in mind, having the first IP (network ID) and last IP (broadcast), we can use simple subtraction to determine the amount of hosts within a given network. Now you know exactly what to do to have your peers look at you with awe of your grand networking abilities and become a go-to man (or woman) for your boss. I wish you the best at your next office party, and may these networking tricks be ever in your favor!

--

--

Aquiles Gomez
Tech Jobs Academy

|Technology|Leadership|Inspiration|. Feel free to highlight and comment anywhere on my guides and we can start a discussion!