IT Education
Apr 4, 2024

IPv4 Addressing Lesson: Network IDs and Subnet Masks

NGT Academy
NGT Academy

We’re going to break down network IDs and subnet masks. With the given network ID 192.168.1.0 let’s look at what the subnet mask is and also the CIDR notation and see how our subnet mask and our CIDR notation help us figure out what a network ID really is. The /24 is called the CIDR notation, which means Classless Inter Domain Routing. Normally you will see it like 192.168.1.0 /24. What this means is this is telling you how many binary digits are turned on in the subnet mask. Our subnet mask is something that’s written in addition to our network ID or IP address. In this example it would look like 192.168.1.0 and the subnet mask being 255.255.255.0. We can see that the first three octets are all turned on and if we add 8 plus 8 plus 8, we get 24. That’s how we get our CIDR notation. If we translate this from decimal to binary it would give us 255.255.255.0.

Now we’re going to figure out what the mask actually means a little more whenever we’re determining what our network ID is. Let’s look at a new example. We have the subnet mask 255.255.248.0 at the top. For reference we are going to be using our chart and we can figure out our CIDR notation from the subnet mask directly. We know that 255 is all ones so we need to look at the third octet, 248. To get to 248 we have to start at 128 and keep adding until we get to 248. 128 plus 64 is 192, not there yet. 192 plus 32 is 224, not there yet. 224 plus 16 is 240, almost there. 240 plus 8 is 248, there we are. 

At this point we have figured out the subnetting bits and everything else is considered to be host bits. What does that mean for our CIDR? Well, we knew we had 255.255 for a /16 and if we add the 5 bits that we borrowed we get a CIDR notation of a /21.

Figuring out the network ID

Moving on to the IP address, we have an IP address 192.168.40.55. Just to recap we already have the subnet mask and we’re given the /21 CIDR notation and from that we can figure out what the actual network ID is. From the start we know that 192 and 168 are going to be a part of the network ID because the mask includes all ones there. If there’s all ones that means you need to use these numbers. Our first two octets and our subnet mask have 255 and 255, then we know we need to use the first two octets of our IP address in the network ID. So, it’s going to start with 192.168. Here is where it gets a little bit more fuzzy as we go into the third octet, because that’s where the mask is a little bit fuzzy as well. That’s where our 21 bits go into. We’re at 16 then they bleed into the third octet till the 21st bit and then our mask cuts off somewhere in that third octet. 

With 40 being in the third octet we could easily determine that by adding 32 and 8 or 00101000 in binary. When we were working on the subnet mask, we calculated 248 to be 11111000 and when we put the subnet mask up against our IP address we can see that everything here where we have our subnet mask, all the bits in the IP address need to be used in the network ID because the subnet mask tells us what our network ID is. Anyhow, these digits in the subnet mask of the third octet are telling us that 40 is also part of our network ID because the bits that go along with the extension of the subnet mask here, include 40 in them. Our network ID is 192.168.40.0 with a CIDR notation /21 and we also know our subnet mask is 255.255.248.0. This will include hosts from the three bits of the third octet and the entire fourth octet.

Conclusion

To recap we discussed that a CIDR notation tells us how many binary digits are turned on in the subnet mask. Our subnet mask is something that’s written in addition to our network ID or IP address. We also worked through an example to figure out our network ID.

Subscribe to the NGT Academy Newsletter

Subscribe to our weekly newsletter for valuable tips and advice, IT news and trends, and more to stay ahead.