Let's talk about some IP subnetting! What is IP subnetting? To my understanding, it's a method to segment your network so you can use it more efficiently. Why do we need to use it efficiently? Because now IPv4 is becoming scarce, with lots of device that is able to connect to the internet, we need more than what IPv4 provided. The switch to IPv6 is going to happen, but it's a slow process to make sure everything is working when IPv6 is goes public and everyone and their grandparents, pets and what so ever can connect to the Internet easily. So what can we do to the current IPv4? We subnet it! What does it mean? It means we slice up the network reeeeaaaalll goooooood. Alright, before we start cutting stuff to pieces, we need to find how big we want the pieces to be, so we're gonna talk about how to find the IP range! Or maybe how to measure how big the pieces we want it to be :D
Say, you have an IP that looks like this: 192.168.1.3/30 , what in the world does that mean?! The first part before / should be familiar with you, that's an IP address, even if you aren't an engineer you should've seen it at least once in a movie or some error while browsing int the internet. Now the number 30, which is after the /, is not a part of the IP. "*GASP* WHAT IS THAT MAGIC NUMBER?! WHAT DOES IT DO?!" Relax, that's a subnet mask. Before, I mentioned that we need to know how big the pieces that we want to cut right? Well, that's the function of the subnet mask! So, how do we ACTUALLY slice up the network rreeeeeeaaaaaalll goooood? Now let's look at this!
192.168.1.3 = 1100 0000.1010 1000.0000 0001.0000 0011
30 = 1111 1111.1111 1111.1111 1111.1111 1100
---------------------------------------- AND
1100 0000.1010 1000.0000 0001.0000 0000 = 192.168.1.0
"Wow! The fuck is that mean?!" Hush, friend, let's dissect it step by step. First, you need to turn both the IP address and the subnet mask into binary numbers, and then you do an AND operation with both of them. You do know how to do the AND operation right? Nice! The result will give you the subnet of 192.168.1.3, so that IP address belongs to the subnet 192.168.1.0.Okay so we know what the subnet is, but how do we know how big that piece of the subnet is? Alright, again, to my understanding, the subnet is also the first IP address in the subnet. So we got the first IP address of the subnet, and an Xth IP address of the subnet. Now, remember I said the subnet mask helps you know how big the piece is? Now it's time to use it! If you see the binary number of the subnet mask, you'll see there's a two zeros in it. That's what you use to find out how big the subnet piece is! Or the range of host that can be used in the subnet. So there're only two zeros right? What is the result of 2^2? Four right? Well that means there're four hosts in the subnet! So if you use other subnet mask, just turn them into binary numbers, then find how many zeroes you have, then power it to two (ex: 2^x of zeroes). But in our example, only two can only be used as a host for user.
So why only two host can be used? There's a thing called Broadcast IP address and Network IP address. What are those? Well broadcast address is the IP address that is used if you want to send something to all the host in the subnet, and the network IP address is the identifier for the network. Is this easy enough to understand? Well if not, I found some nice reference that can explain these two terms better than me here. But how do we know which one is the Broadcast IP address and which one the Network IP address? If you're using the power method, it's easy! The first IP address of the range is the Network IP address, and the last IP address of the range is the broadcast address. Simple right?
Alright, that is all that we need to subnet a network. A way to find the IP hosts range, broadcast IP address and network IP address then you should be good. All of this is good to plan the subnet on paper first, you still need to configure the real network in the end. Oh and your router at home won't be able to do network subnetting, because it's mostly used as access point to the outside network and can't handle several network in it. So either train with packet tracer or GNS3, but be mindful since there'll be some problem you might meet, or buy a REAL router which can handle lots of network! I totally not recommend this though, that shit is very expensive and tends to be marketed towards business. So, next up, I'll try to write a tutorial about subnetting in packet tracer, since I actually haven't succeed yet with subnetting in packet tracer too. So we're both gonna learn something new :D
Well then, I guess that's about all I can share today. Here's the reference for this tutorial, it's actually some summary from the reference, but I try to make it understandable to people who is not familiar with IT terms. And as always, this just my understanding about IP subnetting, I could be wrong in some part, so if you do find something wrong, I'm happy to correct it. Because knowledge is meant to be shared :). Then till next time :D